1st Summative Test Java 11 For 2nd Quarter
1st Summative Test Java 11 For 2nd Quarter
Department of Education
Region 02(Cagayan Valley)
SCHOOLS DIVISION OFFICE OF ISABELA
QUEZON DISTRICT
306112- BARUCBOC NATIONAL HIGH
SCHOOL
Quezon, Isabela 3324
(0926) 934-3805[email protected]
Table of Specification
JAVA PROGRAMMING NCII
SUMMATIVE TEST
Total 20 25
Checked: Noted:
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.");
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!)
(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
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
18 for ( int j = 0; j < 5; j++ )
{
System.out.print( j + " " );
}
System.out.println( );
a. 0 1 2 3 4 5 c. 1 2 3 4 5
b. 0 1 2 3 4 d. 1 2 3 4
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 b. j=j+2
c. 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
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
Checked: Noted:
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