• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some minor typos about Review Questions and mock explanation in chapter 5 (Java OCA 8 Programmer I)

 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1. Review question:
On page 291, review question #2, line should be “7” instead of “8”
The correct answer is option E, “The code will not compile because of line 8. but compile error happens on line 7.

Mock explanation:
On page 346, explanation the same question:
2. E. The code will not compile because the parent class Mammal doesn’t define a no-argument constructor, so the first line of a Platypus constructor should be an explicit call to super(int age). If there was such a call, then the output would be MammalPlatypus, since the super constructor is executed before the child constructor.

But if we call super(5); the output will be Mammal not MammalPlatypus. The output would be MammalPlatypus if call new Platypus(); instead of new Mammal(5); .
Sorry if I am wrong


2. On page 294, review question #10:
Option C is not correct according to “extend”.
C. Both can be extended using the extend keyword.

But in explanation of this question (on page 348) is written “extends”.
“Both abstract classes and interfaces can be extended with the extends keyword, so option C is correct”.

Maybe authors intend to write extends in option C.


3. On page 295, review question #13:
“{” is missing in first line
should be

4. On page 295, review question #14:
I guess that the answer of this question is incorrect but maybe I understand wrong. I chose option B and C when I test it. But the correct answer is only C in book.
B. A class that implements HasVocalCords must override the makeSound() method.
C. A class that implements CanBark inherits both the makeSound() and bark() methods.

But explanation of this question (on page 348) is different.
“Option B is incorrect, since an abstract class could implement HasVocalCords without the need to override the makeSound() method”.

Maybe authors intend to write “An abstract class” instead of “A class” in option B.


5. On page 347, mock explanation #3:
In fourth sentence CanHope interface should be CanHop.


Maybe I think some points wrong for my poor English, sorry for this)

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:On page 291, review question #2, line should be “7” instead of “8”

Agreed

Mushfiq Mammadov wrote:The output would be MammalPlatypus if call new Platypus(); instead of new Mammal(5); .

Correct. This was reported to be last night by email so I gave that person "credit" in the errata list.

Mushfiq Mammadov wrote:Maybe authors intend to write extends in option C.

Yes

Mushfiq Mammadov wrote:“{” is missing in first line

Yes

Mushfiq Mammadov wrote:4. On page 295, review question #14:
I guess that the answer of this question is incorrect
Maybe authors intend to write “An abstract class” instead of “A class” in option B.

I think this one is correct in the book. An abstract class is a type of class. Which means it is possible for a class to implement the interface without implementing that method. The "trick" in the question is to see if you recognize that situation. Giving away in the answer that we are thinking about abstract classes makes it to easy.

The question doesn't say "any class", it says "a class". Which means "there exists a class that makes this statement true."

Mushfiq Mammadov wrote:5. On page 347, mock explanation #3:
In fourth sentence CanHope interface should be CanHop.

Yes
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
I think this one is correct in the book. An abstract class is a type of class. Which means it is possible for a class to implement the interface without implementing that method. The "trick" in the question is to see if you recognize that situation. Giving away in the answer that we are thinking about abstract classes makes it to easy.

The question doesn't say "any class", it says "a class". Which means "there exists a class that makes this statement true."


"Which statements are true.." questions are harder questions for me than others. Because of sometimes I don't understand exactly which means in the questions for my English. After your reply I understand that If we see "a class" we consider that abstract class may include in it also, isn't it?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:. After your reply I understand that If we see "a class" we consider that abstract class may include in it also, isn't it?

Correct.

Mushfiq Mammadov wrote:"Which statements are true.." questions are harder questions for me than others.

Remember that these will be easier on the real exam because the exam tells you how many are correct. (We don't to make it more challenging - you learn more from the harder questions.) If you know there are 2 correct answers and only see 1, you are going to keep looking for what else could be correct. Or you'd look for which ones are definitely wrong and see what is left.
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote: Remember that these will be easier on the real exam because the exam tells you how many are correct. (We don't to make it more challenging - you learn more from the harder questions.) If you know there are 2 correct answers and only see 1, you are going to keep looking for what else could be correct. Or you'd look for which ones are definitely wrong and see what is left.

It is a good information, thanks
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
Mushfiq Mammadov wrote:4. On page 295, review question #14:
I guess that the answer of this question is incorrect
Maybe authors intend to write “An abstract class” instead of “A class” in option B.

I think this one is correct in the book. An abstract class is a type of class. Which means it is possible for a class to implement the interface without implementing that method. The "trick" in the question is to see if you recognize that situation. Giving away in the answer that we are thinking about abstract classes makes it to easy.

I have one (very) small (but important) remark: if “An abstract class” instead of “A class” was used in option B, then option B would still be incorrect Reason is obvious: an abstract class can have abstract methods, it's not required to implement/override a method from an interface. This code will compile successfully:
If the statement of option B would be changed to A non-abstract (concrete) class that implements HasVocalCords must override the makeSound() method., option B would be a correct answer!The Cat class is a concrete (non-abstract) class and must implement the makeSound method, otherwise the code won't compile.

Hope it helps!
Kind regards,
Roel
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:The Cat class is a concrete (non-abstract) class and must implement the makeSound method, otherwise the code won't compile.Hope it helps!

I understand option B as this. I considered "A class" as a concrete class therefore I think option B is correct
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:I considered "A class" as a concrete class therefore I think option B is correct

Oh wait, now I get what you meant. You suggested to replace "A class" with "An abstract class" just to make your life a little bit easier Because with this replacement that statement would obviously be wrong and then it would be easy-peasy-lemon-squeezy to answer that question correctly. But mock exams should not be easy, they have to be really tough so you are well-prepared for the actual exam. Therefore I prefer a mock exam which doesn't mention the number of correct answers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic