Name:     ID: 
 
Email: 

Quiz 1

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 1. 

What is the value of the following expression

3 * 2 + 10 / 4 + 2
a.
10
b.
6
c.
10.5
d.
None of these
 

 

 

 

 

 2. 

What is the value of the following expression

32 / 3 / 3 / 2
a.
2
b.
1
c.
3
d.
None of these
 

 

 

 

 

 3. 

Given the following variable declarations

int number =  0,  total;
final int MAX =  100;
int myNum=  50;


How many variables are declared?
a.
5
b.
2
c.
1
d.
3
e.
4
f.
None of these
 

 

 

 

 

 

 4. 

What is the value of the following expression

27 % 6 + 7 % 4
a.
5
b.
6
c.
2
d.
None of these
 

 

 

 

 

 5. 


What is the value of the following expression

(10+2)*3
a.
15
b.
16
c.
36
d.
None of these
 

 

 

 

 


Short Answer
 

 6. 

What output is produced by the following statement? What is produced if the inner parentheses are removed?


System.out.println ("It is good to be " + 5 + (5));

 

 

 

 

 

 7. 

Write a single statement that will output the following to the monitor:

sa007-1.jpg

 

 

 

 

 

 8. 

Write a single println statement that will output the following exactly as shown (including line breaks and quotation marks).


sa008-1.jpg

 

 

 

 

 

 9. 

If an integer variable num currently holds the value 10, what is its value after the following statement is executed? 

num /= 3;
 

 10. 

What output is produced by the following code fragment?

System.out.print ("One ");
System.out.println ("Two ");
System.out.println ("\nThree ");

 

 

 

 

 

 11. 

Write a single statement that will output the following to the monitor:

sa011-1.jpg

 

 

 

 

 

 12. 

What makes the four integer data types different?

 

 

 

 

 

 13. 

What value is contained in the integer variable base after the following sequence of statements is executed?

int base;
int result=5;
base = 5;
base = result + 3;
base += result;

 

 

 

 

 

 14. 

What output is produced by the following code fragment?

System.out.print ("Ready \n");
System.out.println ();
System.out.println ("Set ");
System.out.println ();
System.out.println ("Go ");

 

 

 

 

 

 15. 

What are the four integer data types in Java?
 



 
         Start Over