• 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

New Assertions Exam

 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just uploaded a beta version of a
new assertions exam. At this time, it only has eight questions. I will be adding more questions over the next few days.
This beta version of the assertions exam is not accessible from the home page of my mock exam. Instead, it is only available at the link provided above.
It is possible that I might upload changes to the beta version of the assertions exam at any time. To avoid opening a question and answer page that are out of sync, please open both the question and answer pages in separate windows.
Please give it a try and let me know what you think. Is it too easy, too difficult, or just about right? Are there any answers that you don't agree with?
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dan:
Good questions. As usual your question require substaintial brain work (for me at least). However, I have doubts following question:
Question 8

Which statements are true?
a. With assertions enabled it prints an error message.
b. With assertions enabled it prints nothing.
c. With assertions disabled it prints an error message.
d. With assertions disabled it prints nothing.
e. An assertion should not be placed at any location that the programmer believes will never be reached under normal operating conditions.
f. The assert statement indicates that the programmer expects no more than one boolean, b1, b2, or b3 to be true.
g. The assert statement is being used to verify an invariant.
h. A compiler error is generated.
i. None of the above.
The answer is a d f g.
The wording of a is bit confusing. Do you mean to say that AssertError is also a regular error message?
f does NOT seem to be right. The statement:
assert b3 & !b2 & !b1;
expects b2 and b1 to be true. That is more than one true.
g. Which invariant are you refering to?
Thanks Dan for your great work.
Barkat
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I retract. I think the original option f stated as:
f. The assert statement indicates that the programmer expects no more than one boolean, b1, b2, or b3 to be true.
should be stated as:
f. The assert statement indicates that the programmer expects no more than one boolean to be true and that boolean should be b3.
[ September 11, 2002: Message edited by: Barkat Mardhani ]
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Barkat,
Thank you for your feedback.
I only have about a minute so I can only write a very quick response now.


f. The assert statement indicates that the programmer expects no more than one boolean, b1, b2, or b3 to be true.


The assert statement is placed after a series of if/else statements. The first "if" is processed if all of the booleans are false. The second is processed if only b1 is true. The third is processed if only b2 is true. The assert statement verifies that only b3 is true.


assert b3 & !b2 & !b1;


This suggests that the programmer expects the three booleans to be in only one of four states--all are false or only one is true. This expectation is an example of an invariant and the assertion is used to verify that the expectation is correct.
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dan:
Based on our explaination f should be reworded to:
asert statement and all if statements indicate that programer is expecting only one true..
Other option is in my second post above...
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Barkat,
Yes, I agree. I think I'll upload the following version.


The combination of the if/else statements and the assert statement indicate that the programmer expects no more than one boolean, b1, b2, or b3 to be true.


Thank you.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your good questions!
I'm looking forward for more questions about assertions, maybe using the other form of the statement too?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dan..
I was looking forward to your Assertion exam.. questions are really good as usual..
And as you are keeping your contineous effort.. May I ask you for more??
How about a Thread questions on your exam???
Thanks again..
Niral
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Niral Trivedi:
Thanks Dan..
How about a Thread questions on your exam???
Niral


Yes, I will start working on a thread exam after I add more questions to the assertions exam. I will probably get started on threads next week.
Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic