This website is preserved for historical and scholarly reference and is no longer actively maintained.
QUIZ 8
September 11, 1998
#1. Given the code segment
if (hours <= 60 )
if (hours > 40 )
System.out.println ("Overtime");
else
System.out.println ( "Double overtime" );
(a) if hours == 50, what, if anything, will be printed?
(b) if hours == 30, what, if anything, will be printed?
(c) if hours == 100, what, if anything, will be printed?
#2. Given the code segment
if ( hours <= 40 )
pay = hours * rate;
else
pay = 40 * rate + (hours - 40 ) * ( rate + rate/2 );
give a minimum set of test data (i.e., what values of hours must be tested?)
#3. Explain Edsgar Djikstra's statement, "Testing merely confirms the presence of errors, never their absence."