Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 5 Review Question #17 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Jan Stückrath
Greenhorn
Posts: 24
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently reading the OCA Java SE 8 Programmer I Study guide of Boyarsky and Selikoff and I have a question about the solution of review question #17 of chapter 5. I do unterstand why the code does not compile, but I am confused about how the question is written. The solution says that B is correct and that "if the body {} was removed from line 2, the code would still not compile, although it would be line 8 that would throw the compilation error". Doesn't this mean that B and C (together) are the correct answer? In fact, when I ask the compiler (version 1.8.0_66), it complains about both problems (note that my line numbers are slightly different):

The question does not end with "Choose all that apply", so I assume that only one option should be correct. Since I picked B,C as my answer, I was wondering, is this indended or an error? If I encounter such a question in the exam, would the right answer be to choose the compilation error with the least line number?
 
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
Jan Stückrath wrote:Since I picked B,C as my answer, I was wondering, is this indended or an error?

That's a tough one! But I think we should follow the compiler on this one. And the compiler lists two errors: one for an invalid abstract method declaration (on line2) and another one for a concrete class not implementing an abstract method (on line8). So answers B and C should be marked as correct. If you have marked B and C as the correct answers, give yourself 1 point for this question

Jan Stückrath wrote:If I encounter such a question in the exam, would the right answer be to choose the compilation error with the least line number?

First of all, if you encounter such a question on the exam, the question will mention how many correct answers you have to select. And with this question I would assume you have to select 2 answers. If this question would mention only to select 1 answer, I think the answer options will be different (e.g. option C is "The code will not compile because of line 4"), otherwise there is too much doubt and confusion (as both B and C can be considered to be correct). Don't forget that actual exam questions are thoroughly tested before they are added to the exam question bank.

Hope it helps!
Kind regards,
Roel
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan,
This question doesn't say "choose all that apply" which means only one answer is correct. We tried not to have multiple correct answers on the "does not compile" questions. That way we are always talking about the first compiler error if more than one. In this case B.

The reason for that is some compilers (especially IDEs) give more or less compiler errors than others. They all agree on whether code compiles or doesn't. Just not in how many reasons they give you!
 
Jan Stückrath
Greenhorn
Posts: 24
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so B and C would both be correct, but it was intended to be only B since it was the first compiler error. Thanks, that helped.
I am really glad that the exam will state how much answers are correct. That should make it a lot easier, especially since one can check - at least to some extent - if the chosen answers can be right.

Roel De Nijs wrote:If you have marked B and C as the correct answers, give yourself 1 point for this question

And thanks to Roel for increasing my average score.
 
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
Jan Stückrath wrote:OK, so B and C would both be correct, but it was intended to be only B since it was the first compiler error. Thanks, that helped.

And since you have gone through the mock questions of chapter 5, you definitely have answer question 4 as well. And in this question you had to choose all that apply and therefore you had to select two answers denoting different compiler errors.

Jan Stückrath wrote:I am really glad that the exam will state how much answers are correct. That should make it a lot easier, especially since one can check - at least to some extent - if the chosen answers can be right.

That's indeed a very nice and helpful feature. Because even if you don't really know the answer(s), you know how many to select and using elimination of the definite wrong ones you might even be able to "guess" the correct ones. Also please note that there's no negative score for a wrong answer (so you get either 1 point or 0 points for each question), so you can guess for free
 
Jan Stückrath
Greenhorn
Posts: 24
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Jan Stückrath wrote:OK, so B and C would both be correct, but it was intended to be only B since it was the first compiler error. Thanks, that helped.

And since you have gone through the mock questions of chapter 5, you definitely have answer question 4 as well. And in this question you had to choose all that apply and therefore you had to select two answers denoting different compiler errors.

Yes, and I chose the two correct answers. That was also why I was confused. My main concern was about which answers to choose if this situation happens on the exam. I can obviously not discuss the answers there.

Roel De Nijs wrote:
Jan Stückrath wrote:I am really glad that the exam will state how much answers are correct. That should make it a lot easier, especially since one can check - at least to some extent - if the chosen answers can be right.

That's indeed a very nice and helpful feature. Because even if you don't really know the answer(s), you know how many to select and using elimination of the definite wrong ones you might even be able to "guess" the correct ones. Also please note that there's no negative score for a wrong answer (so you get either 1 point or 0 points for each question), so you can guess for free

I think the best strategy is to check the answers and seperate them into "definitely true", "definitely false" and "maybe". Then, knowing how much statements are correct, you try to select enough "maybes". Of course, if the number of correct statements is lower than your "definitely true" answers or higher that your "definitely true" and "maybe" answers, you should read the question more carefully.
 
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
Jan Stückrath wrote:I think the best strategy is to check the answers and seperate them into "definitely true", "definitely false" and "maybe".

My strategy: for each question I always read each answer and tell myself (those little voices in my head :wink why this answer is correct or wrong. So even if the question states to select two correct answers and I have already selected A and B as the correct answers, I'll still go through all other answers to verify if these answers are really wrong.
 
Jan Stückrath
Greenhorn
Posts: 24
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:So even if the question states to select two correct answers and I have already selected A and B as the correct answers, I'll still go through all other answers to verify if these answers are really wrong.

Yes, I will also do that. If you stop immediately, you would be tricked into thinking that the two selected answers must be correct. Only if you forget about the number of correct answers when going through them, you can error-check your choice. Actually, by stopping immediately you are doing yourself more harm than it helps (unless you are really running out of time).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic