• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Volker Glave
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Volker Glave
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BB wrote:

> [...]
> hth

Yes, thank you, I do follow.
Volker Glave
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic