my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B SCJP 5: Chapter 8, Self Test 9, wrong answer? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "K&B SCJP 5: Chapter 8, Self Test 9, wrong answer?" Watch "K&B SCJP 5: Chapter 8, Self Test 9, wrong answer?" New topic
Author

K&B SCJP 5: Chapter 8, Self Test 9, wrong answer?

Volker Glave
Greenhorn

Joined: Aug 16, 2006
Posts: 3
In K&B SCJP 5 this is the given solution to Chapter 8
Self Test 9 (pages 662/669/670):



First I voted "G", too, but then switched to "F".
Because, yes, the semicolon is missing, but the compiler will
flag this as an error not until line 8 at the "System".

Enough talking, let's verify:



qed

Three questions:

- Is it really an error in K&B SCJP 5 or am I missing something?

- I looked up the "K&B, SCJP 5 - Errata: Updated 7/28/06" page.
A correction to page 669 is given:
"669....typo......Answer s/b: A,B,D,E, and F are incorrect"
That's even more mysterious to me. First, based on the things
above it's not a correction. Second, why "C" is taken away?

- More important: At the real SCJP exam, can you be (on one
question or the other) just be "to smart" ;-) ... and should
you anticipate and click the would-by-correct-answer even if
you know it's wrong :-) ?

Regards,
Volker Glave
Arul Prasad
Ranch Hand

Joined: Jan 20, 2005
Posts: 57
hi Volker Glave
you are right , but i hope this question is not concentrating on which line Compile Error has occured , but it was the reason why the compilation fails , eventhough the compile Error happen in the line No 8

TestObj.java:8: ';' expected
System.out.println(o.equals("Fred"));

but the reason was not the illegal statment in line no 8 but it was because of the illegal statement in the line 7 ...

hope i am right ...
[ August 16, 2006: Message edited by: Arul Prasad ]

With Regards<br />Arul
Volker Glave
Greenhorn

Joined: Aug 16, 2006
Posts: 3
Hi, Arul.

Arul Prasad wrote:
> you are right , but i hope this question is not
> concentrating on which line Compile Error has occured,
> but it was the reason why the compilation fails,
> eventhough the compile Error happen in the line No 8
> ...
> but the reason was not the illegal statment in line
> no 8 but it was because of the illegal statement in
> the line 7 ...

Yeah, this reasoning follows the one given in K&B.
But it's not right either. Yes, the illegal statement
has to be corrected by adding a semicolon. But this
adding does not _necessarily_ has to be on line 7.
It could quite equally be added on line 8, for
example:


So again, the correct answer to the Self Test question
"What is the result?" is "F. Compilation fails because
of an error on line 8." - and that's it!, since the error
_is_ on line 8.

One has to be merciless about this, I think, since
accuracy is one of the fundamentals the SCJP exam is
all about in the first place.

Greetings
Volker
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
Hi Guys,

First off, I think the errata is correct as it refers to a different question

The exam creation team has consistently reasoned that a question can't be based on the exact response of a compiler, since these responses might vary from compiler to compiler. Hence the phrase "won't compile due to an error on line X", will often appear in answers on the real exam. In other words, in a given situation, (such as, apparently, the question in question) one compiler might complain about line X and a different compiler might complain about line X+1.

The argument that the semicolon could go on the next line of the .java text file is technically valid, but the exam creation team would probably dub that answer "obtuse" In other words, standard java code would always be written with the semicolon at the end of line 7. Sometimes the exam creation team is forced to cram a couple of lines of code together (this is due to space limitiations of the world-wide exam delivery tool), but in such a case the question won't concern the location of an error. So, if the question asks you where an error might be, the code will be of a standard format.

hth,

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Volker Glave
Greenhorn

Joined: Aug 16, 2006
Posts: 3
BB wrote:

> [...]
> hth

Yes, thank you, I do follow.
Volker Glave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: K&B SCJP 5: Chapter 8, Self Test 9, wrong answer?