• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Confusing Assertions Question

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Please check out the following question extracted from K&B Master Exam #2.

Given :



What is the result ?

a) done
b) bar done
c) foo done
d) bar foo done
e) Compilation fails
f) An AssertionError is thrown at runtime.

The correct answer is A. Here's the Master Exam's explanation :
"A is correct, both assert statements are true, so the bar and foo methods are not called."

In my first attempt I also chose A but not due to reason as explained above.

Here's MY explanation :
"Once assertions are disabled at runtime in Java 5 by default, these two assert statements are simply ignored at runtime".

This question didn't mention anything whether assertions were enabled at runtime. So I considered the default behavior.

Could you please give your comments and correct me if I'm wrong ?
 
author
Posts: 9031
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Edisandro,

Good question. I'm not going to quite call this one an errata - almost, but not quite. I have, however added a note to clarify the question in the mock exam.

In general, the questions on the real exam will tell you what you need to know, and in this case the question would have said that assertions were enabled. On the other hand, the general rule for the real exam is that if something is not stated explicitly, assume it's working. So things like correct compilers and JVMs and classpaths and imports, and command line invocations and stuff should be assumed to be correct if they're not listed explicitly on the question.

So for instance, if you see a code snippet without the entire class listed, you can assume the import statements are correct.

On the other hand, if you see a complete class listing and you think an import statement is missing, that might be the key to the question.

Does that make sense?

hth,

Bert
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bert.

It's always good to know which kind of question we are expected to see on the real exam.

Your tips about how to treat explicitly issues on the real exam also were really useful for me.

Thanks.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edisandro!!
u R doing a good JOB man!!!
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Edisandro!

Sorry for a little off topic... I see you are working hard all the time and think you would be very dissapointed if you scored less than 100 % I belive you can achieve that score! Do you remember our classpath questions? They can be difficult, I had problems with one though I thought I knew everything about it after all our discussions As you know I passed SCJP at the end of March and plan to take SCWCD next month, hurry up man, coz I'll get another one before you get your SCJP... just teasing!!!

Let me know after you take the exam and how you did! Good luck!
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aleksander,

I'm really working pretty hard since January 18th, 4 hours a day, 6 days a week. I decided to use this plan of attack just to compensate the fact that I'm really new to Java.

I'm going to write the exam on next April 22nd. I'm feeling my tummy cold.

Honestly, I don't care about scoring less than 100%, but of course I'm working pretty hard expecting to eat my certification in my first attempt.

Best Regards.
[ April 15, 2006: Message edited by: Edisandro Bessa ]
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Moderators,

I'm sorry to post such comments here. I think it would be more appropriate to send a private message instead.

Shall we come back to the original issue started in this thread ?
[ April 15, 2006: Message edited by: Edisandro Bessa ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic