Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

ambiguous questions for JCP ?

Thread view: 
Andreas Leitgeb - 13 Nov 2006 13:36 GMT
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?
Daniel Pitts - 13 Nov 2006 17:59 GMT
> I'm currently studying for the "Java certified programmer", and
> some book (whose authors claim to have had some deeper insight
[quoted text clipped - 5 lines]
> that an int-compatible variable named "abcd" is in some way
> visible at this point (e.g. even through static import).
The answers are usually multiple choice, and that gives you enough
context to answer correcty.  At least on the practice exams I've taken.

> 2.)  "if  obj is an instance of Object ..."  then follows a question
> whose answer depends on whether obj is really only Object (and not
[quoted text clipped - 8 lines]
>                  integer-literals!
>From my understanding, the JCP doesn't ask about bad-style/practices,
only valid syntax.
>   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.
The semicolon is actually optional, and is only needed if you are
adding members to the base enum class E.  Remember, enums are classes,
and each value has its own class, and therefor can have its own
members.

enum E { A { int aInt; }, B, C; int eInt; E() { eInt = ordinal() + 1; }
}
is valid as well as
enum E { A }

> 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
[quoted text clipped - 4 lines]
> then find I've got too little percentage in the corresponding
> section, would it be feasible to question the result?

Well, this might just be the blind leading the blind, as I haven't
taken the cert yet myself, but hopefully I've answered your questions
correctly.  Good luck.

Daniel.
adwords@pulpjava.com - 14 Nov 2006 05:35 GMT
WHy not try the SCJA certification first.

There are some sample mock exams here: www.scja.com

Cheers!

-Cameron McKenzie

> > I'm currently studying for the "Java certified programmer", and
> > some book (whose authors claim to have had some deeper insight
[quoted text clipped - 48 lines]
>
> Daniel.
Andreas Leitgeb - 14 Nov 2006 13:32 GMT
> The answers are usually multiple choice, and that gives you enough
> context to answer correcty.  At least on the practice exams I've taken.

While I deprived the sample questions even of their (minimal)
context when quoting them here, I wouldn't have quoted them, if their
context had given that information. The context inferred by the other
solutions is more often a pitfall than a help. (in that particular
book, that is)

> Remember, enums are classes, and each value has its own class,
> and therefor can have its own members.

I wouldn't say so.  Of course, this code is correct:

> enum E { A { int aInt; }, B, C; int eInt; E() { eInt = ordinal() + 1; } }

but only A is of a different class (namely E.$1) than B and C.
The latter ones are both exactly class E

Btw, the "compile-time" type of A (still E) doesn't allow one
to access "aInt", but with reflection, one can.
Tris Orendorff - 13 Nov 2006 22:38 GMT
> I'm currently studying for the "Java certified programmer", and
> some book (whose authors claim to have had some deeper insight
[quoted text clipped - 9 lines]
> whose answer depends on whether obj is really only Object (and not
> more). For any object, (object instanceof Object) is true, after all.

You have a bad book.  Google for "java certification" and you will see
that certain books are preferred.  The questions on the exam are often
tricky but always fair.

Signature

Sincerely,

Tris Orendorff
[Q: What kind of modem did Jimi Hendrix use?
A: A purple Hayes.]

Andreas Leitgeb - 14 Nov 2006 14:49 GMT
> You have a bad book.  Google for "java certification" and you will see
> that certain books are preferred.  The questions on the exam are often
> tricky but always fair.

Thanks a lot for this relieving information!

I didn't find this book generally bad, but it's good to know
that if something seems fishy in the book, then it's just the
book that's fishy, and (at least most likely) not the exam.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.