File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assertions Q 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 "Assertions Q" Watch "Assertions Q" New topic
Author

Assertions Q

Monisha Talwar
Ranch Hand

Joined: Feb 11, 2003
Posts: 102
I took the exam on April 16th....rather late to ask a question, but this has been lurking on the back of my mind since that day!
I had a question on the exam about assertions....Moderators/Sherrifs/Bartenders - Don't freak out, I am not giving out the question
Anyway...I was given a snippet of code and I had to basically pick from options like :
a. "compiles and runs with so and so out put"
b. "compilation fails"
c. "runtime fails"
d. etc.
Anyway...the question did not say anything about how the code was compiled or run. I mean it did not say that we specifically compiled it with the -source1.4 flag. Nor did it say we enabled assertions.
I was a little confused how to approach this question. There seemed to be no compilation errors in the code. I also did not think there would be runtime errors. I was confused if I should have pick the option which would have the output as if assertions were enabled. Or should I have picked the option as if they were disabled.
I finally convinced my self to pick the answer which would have output the result as if assertions were disabled...cause they are disabled by default and if they did not specify in the question that they were enabled, I was just going to assume they were disabled. I have no idea if I was right or wrong. :roll:
I would really like to know....Plus it would help others who may be taking the exam soon.What should one assume on such a question in the exam?
Monisha.


Hey! It compiles! Ship it!
Monisha Talwar
Ranch Hand

Joined: Feb 11, 2003
Posts: 102
By the way the questiong just asked "what will happen if you run the code below..."
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
I know the answer to this one
We have put something about it in the intro to the exam (which nobody reads, including me) about the assumptions, but I can't remember the exact language.
Anyway, you are to assume that everything is configured and working normally, given what you are trying to do. So unless you are *explicitly* asked a question about *how* to enable assertions, then assume that they ARE enabled.
You are not the first person who has asked this question, so perhaps on the next revision of the exam we will add that language directly to the question.
But this assumption applies to EVERYTHING.
Because think about it -- otherwise every single question on the exam would have to be worded like...
"Assuming that Java is installed and configured properly, and that you are in the correct working directory..."
So if you always make that assumption, you'll be good. But I agree, with assertions it is very confusing, since both enabled and disabled are potentially "correct", and disabled is the default!
Good question to raise here for the others!
cheers and thanks,
Kathy
Monisha Talwar
Ranch Hand

Joined: Feb 11, 2003
Posts: 102
Ah Kathy! Thanks for solving the mystery...although now I know I got the answer wrong in the exam
Kathy, you are right I did not read the assumptions and instructions in the beginning very clearly...I was concerned about loosing time because the count down had already started - but there goes - I lost a question! Ah never mind, I was happy with my score anyway
You guys going for the exam - REMEMBER THE ASSUMPTION!!
I would also like to add that at the beginning of the exam - you have to take a Sun survey of 15 questions - the clock has already started ticking...so as far as I was concered I just wanted to get over with it, and start the exam. I feel if this survey was at the end - after the 2 hours...and was compulsory - one would atually read, analyze and answer correctly...just my opinion...The survey result would probably more accurate and useful for Sun too.
Monisha.
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Thank you very much, Monisha. I am sad to hear you made the wrong assumption. I would have made the same assumption myself.
Thank you Kathy for the clarification.
Rory French
Ranch Hand

Joined: Apr 03, 2003
Posts: 97
Yes, thanks for raising this Monisha. I would have made the same assumption as you in this case. I think you've helped a good few of us who are yet to take the exam. I'm just sorry your score had to suffer a little in the process.
Nevertheless, know that your advice and post-exam wisdoms are much appreciated
Harry D'Souza
Greenhorn

Joined: Dec 28, 2002
Posts: 28
Thank You Monisha. I am sure this discussion will prove helpful to a lot of us who are yet to take this exam in the near future.


Harry D'Souza<br />SJCP 1.4 , SCWCD
John Zoetebier
Ranch Hand

Joined: Mar 28, 2003
Posts: 76
Monisha says:

I would also like to add that at the beginning of the exam - you have to take a Sun survey of 15 questions - the clock has already started ticking...so as far as I was concered I just wanted to get over with it, and start the exam. I feel if this survey was at the end - after the 2 hours...and was compulsory - one would atually read, analyze and answer correctly...just my opinion...The survey result would probably more accurate and useful for Sun too.

Strange, I did the SCWCD exam some time ago and am pretty sure my clock did NOT tick while I was answering these questions.
It looks unlikely to me that Sun has different procedures between exam types.
Or maybe SUN offers some special benefits to people from New Zealand, which I can appreciate of course.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assertions Q
 
Similar Threads
Assertions
assertions
Assertion : Dan's mock question
basic confusion for dealing with assertions!!
Exam doubt