A
Andreas Leitgeb
I'm currently studying for the "Java certified programmer", and
some book (whose authors claim to have had some deeper insight
into the official certification questions) offers sample questions.
Some are dependent on unspecified context:
1.) int myvar = abcd; <-- is this legal ?
In my mind, it is syntactically legal. However it depends on
that an int-compatible variable named "abcd" is in some way
visible at this point (e.g. even through static import).
2.) "if obj is an instance of Object ..." then follows a question
whose answer depends on whether obj is really only Object (and not
more). For any object, (object instanceof Object) is true, after all.
Other questions are actually unambiguous, but answered wrongly in
the answers-section of said book:
char ch = 0x1234; is supposedly wrong, because unicode-literals
must be given in single quotes. - but it's correct,
since char can also be initialized with appropriate
integer-literals!
enum E { A, B, C } is supposedly wrong, because a semicolon is
missing after the last instance - but javac (and
docs) say it's correct so.
Can I assume that the questions on the real exam are unambiguous,
or do I have to look forward to just guess the context for some
questions, or am I better off learning by heart some answers (like
for above examples), despite knowing the answer is really wrong?
If I find a suspicious question during the real exam, and
then find I've got too little percentage in the corresponding
section, would it be feasible to question the result?
some book (whose authors claim to have had some deeper insight
into the official certification questions) offers sample questions.
Some are dependent on unspecified context:
1.) int myvar = abcd; <-- is this legal ?
In my mind, it is syntactically legal. However it depends on
that an int-compatible variable named "abcd" is in some way
visible at this point (e.g. even through static import).
2.) "if obj is an instance of Object ..." then follows a question
whose answer depends on whether obj is really only Object (and not
more). For any object, (object instanceof Object) is true, after all.
Other questions are actually unambiguous, but answered wrongly in
the answers-section of said book:
char ch = 0x1234; is supposedly wrong, because unicode-literals
must be given in single quotes. - but it's correct,
since char can also be initialized with appropriate
integer-literals!
enum E { A, B, C } is supposedly wrong, because a semicolon is
missing after the last instance - but javac (and
docs) say it's correct so.
Can I assume that the questions on the real exam are unambiguous,
or do I have to look forward to just guess the context for some
questions, or am I better off learning by heart some answers (like
for above examples), despite knowing the answer is really wrong?
If I find a suspicious question during the real exam, and
then find I've got too little percentage in the corresponding
section, would it be feasible to question the result?