Name ______________________

Assume the following:

int k = 10;
int j = 6;
boolean b = false;
boolean c = true

I.                   Show what is printed by each of the following statements.

  1. __________ System.out.println( 1 > 2 );
  2. __________ System.out.println( b );
  3. __________ System.out.println( !b );
  4. __________ System.out.println( k > j && j != 5 );
  5. __________ System.out.println( k/2 >= j && j/2 == 3 );
  6. __________ System.out.println( k > j && c );
  7. __________ System.out.println( k < j || j != 5 );
  8. __________ System.out.println( k < j || j == 5 );
  9. __________ System.out.println( !(k > j && j != 5) );

 

II. Write an if statement that does the following:

(a)    When the variable x is between 3 and 5, print "GREAT".

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

 

(b)   When the variable x is between 3 and 5, print "GREAT". Otherwise, print "NOT SO GOOD"

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

 

(c)    When the variable x is between 3 and 5 print GREAT. If it is 3 or below, print "LITTLE". If it is 5 or greater, print "BIGGER".

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________