
First Period Examination - Computer Programming 2
Direction: Read each question carefully then select the letter of the best answer from the
given choices and write it on your respective answer sheet.
I. Multiple Choice.
1. 78:integer ; 74.5:___________
A. String B. Character C. Float D. Boolean
2. “Hello”:___________ ; 143:integer
A. String B. Character C. Float D. Boolean
3. ‘A’:___________ ; 44:integer
A. String B. Character C. Float D. Boolean
4. Amelia is creating a JAVA program that will accept two whole variables and compute and respectively
print their sum. What do you think is the data type she needs to use?
A. String B. Character C. Boolean D. Integer
5. It refers to the values that cannot be change.
A. Variable B. Constant C. Identifier D. Literals
6. It is the keyboard short cut key to create new project.
A. Ctrl + N B. Alt + N C.Alt+Shift+N D. Ctrl+Shift+N
7. What JAVA command are you going to use to be able to create a program that will determine the
Remarks of the inputted grade whether it is Passed or Failed?
A. Loop statement B. If Statement C. Single Array D. Multidimensional array
8. It is a JAVA statement that allows a programmer to execute specific blocks of code a number of times.
A. Command line arguments C. Control structures
B. Repetition control structures D. JAVA arrays
Complete the syntax: For (9.___________; 10.___________; 11. ___________) {
statement 1; statement2; … }
A. Condition B. Execution C. Initialization D. Increment/ decrement
12. It is the section of the For loop statement that updates the loop variable.
A. Condition B. Execution C. Initialization D. Increment/ decrement
13. It is the section of the For loop statement that compares the loop variable to some limit value.
A. Condition B. Execution C. Initialization D. Increment/ decrement
14. It is the section of the For loop statement that prepare the loop variable.
A. Condition B. Execution C. Initialization D. Increment/ decrement
Complete the syntax: 15.___________ while (16.___________) {
statement 1; statement2; …
17.___________ }
A. Condition B. Execution C. Initialization D. Increment/ decrement
18. What will be the output of this code in JAVA programming:
int i=1;
while (i<=3) {
System.out.print(i);
I++; }
A. 1 B. 3 C. 321 D. 123
2 2
3 1
Complete the syntax: 19.___________
do {
statement1; statement2;
20.___________; }
while (21.___________);
A. Condition B. Execution C. Initialization D. Increment/ decrement
22. It is a finite data structure consisting of homogeneous elements or data of the same type and is
referenced with a common name.
A. Loop B. Array C. Polymorphism D. Inheritance
23. It is used to indicate that a variable intArray is an array of a certain data type.
A. { } B. ( ) C. “ “ D. [ ]
24. It is an individual item within an array.
A. index B. array type C. element D. array length
25. In JAVA programming, this part of array always starts with 0(zero).
A. index B. array type C. element D. array length
26. The part of array that refers to the maximum number of elements an array contains.
A. index B. array type C. element D. array length
27. What will be the output of this code in JAVA programming: