1st Summative-Test-Java-11-for 2nd Quarter
1st Summative-Test-Java-11-for 2nd Quarter
com
Table of Specification
JAVA PROGRAMMING NCII
SUMMATIVE TEST
Total 20 25
JAVA Programming
Direction: Read carefully the given questions and choose the correct answer. Write your
answer on the answer sheet provided.
For items 12-20, analyze then identify the output of the following code
12.
int sum = 14;
if ( sum < 20 )
System.out.print("Under ");
else
System.out.print("Over ");
System.out.println("the limit.");
a. Under c. Under the limit
b. Over d. Over the limit
13.
int sum = 14;
if ( sum < 20 )
System.out.print("Under ");
else
{
System.out.print("Over ");
System.out.println("the limit.");
}
(Notice that the program has changed from the previous question!)
a. Under c. Under the limit
b. Over d. Over the limit
(Notice that the program has changed from the previous question!)
16.
int sum = 21;
if ( sum == 20 )
{
System.out.print("You win ");
}
else
{
System.out.print("You lose ");
}
System.out.println("the prize.");
(Notice that the program has changed from the previous question!)
a. You win c. You win the prize
b. You lose d. You lose the prize
17.
int sum = 21;
if ( sum != 20 )
System.out.print("You win ");
else
System.out.print("You lose ");
System.out.println("the prize.");
(Notice that the program has changed from the previous question!)
a. You win c. You win the prize
b. You lose d. You lose the prize
a. 10 11 12 13 14 15 c. 10 9 8 7 6 5
b. 9 8 7 6 5 4 3 2 1 d. 10 9 8 7 6
System.out.println( );
a. -5 -4 -3 -2 -1 0 c. 5 4 3 2 1 0 -1 -2 -3 -4 -5
b. 5 4 3 2 1 0 d. 5 4 3 2 1 0 -1 -2 -3 -4
21. What must the test be so that the following fragment prints out the integers 5 through and
including 15?
for ( int j = 5; ________ ; j++ )
{
System.out.print( j + " " );
}
System.out.println( )
a. int j <15 c. int j <16
b. int j < =15 d. int j ==15
22. What must the change be so that the following fragment prints out the even integers 0 2 4
6 8 10?
for ( int j = 5; ________ ; j++ )
{
System.out.print( j + " " );
}
System.out.println( )
a. j+2 c. j-2
b. j=j+2 d. j=-2
23. A sequence of statements contained within a pair of braces ("{" and "}") is called a:
a. Block c. Branch
b. Blop d. Brick
24. Evaluate (to true or false) each of the following expressions:
14 <= 14 , 14 < 14 , -9 > -25 , -25 > -9
a. true true true true c. true false true true
b. true false false false d. true false true false
25. Say that value has a 19 stored in it, and that extra has a 25 stored in it. Evaluate (to true or
false) each of the following expressions:
value <= extra , extra < value , value > -25 , value >= extra
1. A
2. B
3. C
4. D
5. A
6. C
7. B
8. A
9. B
10. A
11. B
12. C
13. A
14. D
15. D
16. D
17. C
18. B
19. D
20. D
21. C
22. B
23. A
24. D
25. A