0% found this document useful (0 votes)
51 views3 pages

Grade 11 Programming 2ND Quarter Exam

- This document contains instructions for a computer programming exam with multiple choice, true/false, and problem solving questions. - The multiple choice section contains 20 questions about Java programming concepts like data types, operators, loops, arrays, and switch statements. - The true/false section has 10 statements to identify as true or false regarding Java arrays and loops. - The problem solving section asks students to write a Java program that uses a for loop to print the multiplication table for a given number from 1 to 10.

Uploaded by

FRETZIE CAMBIADO
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views3 pages

Grade 11 Programming 2ND Quarter Exam

- This document contains instructions for a computer programming exam with multiple choice, true/false, and problem solving questions. - The multiple choice section contains 20 questions about Java programming concepts like data types, operators, loops, arrays, and switch statements. - The true/false section has 10 statements to identify as true or false regarding Java arrays and loops. - The problem solving section asks students to write a Java program that uses a for loop to print the multiplication table for a given number from 1 to 10.

Uploaded by

FRETZIE CAMBIADO
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ISULAN NATIONAL HIGH SCHOOL

Isulan, Sultan Kudarat


GRADE 11 – TVL – ICT – COMPUTER PROGRAMMING
2nd Quarter Examination
January 22 – 23, 2024

Name:________________________________________________________Score:_________________
General Instructions:
 Read directions carefully and write all your answers in the test papers.
 Cheating is strictly prohibited.
 Write eligibly in the test paper and avoid erasures.

Test 1: Multiple Choice. Choose the letter of your answer and write it on the space
provided before the number.

_______1. What is the default value of a Boolean variable in Java?


a. true c. 0
b. false d. 1
_______2. In Java, what is the result of the expression “true && false”?
a. true c. error
b. false d. 1
_______3. Which logical operator has the highest precedence in Java?
a. && c. !
b. || d. All have the same precedence
_______4. Which of the following conditions is used to specify a block of code to be
executed, if a specified condition is true?
a. if c. else if
b. Else d. switch
______5. Which of the following conditions is used to specify a block of code to be
executed, if the same condition is false?
a. if c. else if
b. Else d. switch
______6. Which of the following conditions is used to specify many alternative blocks of
code to be executed?
a. if c. else if
b. Else d. switch
______7. Which of the following conditions is used to specify a new condition to test, if
the first condition is false?
a. if c. else if
b. Else d. switch
______8. Which of the following short hand if else operator that consists of three
operands and can be used to replace multiple lines of code with a single line?
a. ternary operator c. primary operator
b. secondary operator d. && operator
______9. Which statement that selects one of many code blocks to be executed?
a. if c. else if
b. Else d. switch
______10. What keyword is used to save a lot of execution time because it “ignores” the
execution of all the rest of the code in the switch block.
a. case c. default
b. break d. switch
_____11. What keyword is used that specifies come code to run if there is no case
match?
a. case c. default
b. break d. switch
_______12. What is the purpose of a while loop in Java?
a. Iterate over a collection
b. Execute a block of code repeatedly as long as condition is true
c. Define a method
d. Define variables
_______13. How is condition checked in a while loop?
a. Before entering the loop
b. After executing the loop body
c. Bothe before entering the loop and after executing the loop body
d. Only when explicitly specified using a separate if statement
_______14. Which of the following statements is true about an infinite while loop?
a. It’s an error in java and won’t compile
b. It runs indefinitely until the program is terminated
c. It automatically terminates after a fixed number of iterations
d. It only executes once
_______15. What is the purpose of the continue statement in a while loop?
a. Exit the loop
b. Skip the rest of the loop body and move to the next iteration
c. Restart the loop from the beginning
d. Print a message and continue the loop
_______16. What is the syntax for a while loop in Java?
a. while(condition) {/*loop body/}
b. for(condition){/loop body/}
c. do{/loop body/}while(condition);
d. loop(condition){/loop body*/}
_______17. How can you avoid an infinite loop when using while loop?
a. Use a for loop instead
b. Ensure the loop condition becomes false at some point
c. Add a break statement inside the loop
d. Use the return statement
_______18. Which loop construct is more suitable when the number of iterations is
known in advance?
a. while loop
b. for loop
c. do-while loop
d. break loop
_______19. What will happen if the condition in a while loop is initially false?
a. The loop body will be executed at least once.
b. The loop body will never be executed
c. An exception will be thrown
d. The loop will terminate immediately
_______20. What is the correct way to declare an array in Java?
a. int array[];
b. array int[];
c. int[] array;
d. array[] int;

II. Modified True or False. Write true if the statement is correct, otherwise false it is
wrong.

_______21. Arrays in Java can store elements of different data types.


_______22. The size of an array in Java is fixed once it is declared.
_______23. The length of an array can be obtained using the size() method.
_______24. To declare an array, define the variable type with square brackets.
_______25. You can access an array element by referring to the index number.
_______26. In java for loop syntax, Statement 2 is executed (one time) before the
execution of the code block.
_______27. In the nested loops, the “outer loop” is executed one time for each iteration of
the “inner loop”.
_______28. The do/while loop is a variant of the while loop. This loop will be executed at
least once, even if the condition is false, because the code block is executed
before the condition is tested.
_______29. If the break statement is used as the last statement in a switch block, it does
not need default.
_______30. The value of the expression is compared with the values of each switch.

III. Problem Solving. (31. – 40.) 10pts.

31-40. Write a java program using for loop that prints the multiplication table for a given
number. Use import java.util.Scanner to get the data from the user.
Note: Your program should prompt the user to enter a number, then it prints
the multiplication table for that number from 1 to 10 using a for loop.

Name of Class: MultiplicationTable

Prepared by: Checked & Reviewed by:

FRETZIE P. CAMBIADO GLENDEL C. BERMUDO


Teacher II SHS – Assistant Principal for Academics

You might also like