Sie sind auf Seite 1von 3

Yllana Bay View College

Senior High School Department


Pagadian City

2nd Major Examinations for Computer Programming I

/* Before anything else, write your name, strand, subject and name of your instructor in your booklet. Dili magpa-labad sa ulo,
please. Arigathanks! */

I – Multiple Choice: Write the correct answer in your test booklet. (15 points)

1. It is a container object that holds a fixed number of values of a single type.


a. Array c. Methods
b. Class d. Loops

2. It is a type of linear array. Accessing its elements involves a single subscript which can either represent a
row or column index.
a. Nested Loop c. One-dimensional array
b. Do-while loop d. Public class

3. It is a loop within a loop, an inner loop within the body of an outer one.
a. For loop c. Nested loop
b. While loop d. Hula-hoop

4. It is an array containing one or more arrays, or what we call, an array inside an array.
a. Multidimensional array c. Multidimensional class
b. Multidimensional portal d. Multidimensional scanner

5. It is a class-based, object-oriented programming developed by James Gosling.


a. C++ c. Java
b. Visual Basic d. Mosaic

6. The first calculator invented by man, and was developed in China.


a. Computer c. Abacus
b. Scientific Calculator d. Sundial

7. It is a java type package that holds the input of the user.


a. java.util.Scanner c. printf
b. System.out.println d. cin

8. What is ‘++’ in for loop stands for?


a. Adding 1 number to the parameter c. Adding + to the parameter
b. Adding 2 numbers to the parameter d. Adding ++ to the parameter

9. What is ‘<=’ in programming stands for?


a. Less than c. Switch arrow
b. Less than or equal to d. Arrow sign going to the left

10. It is the process of designing and building an executable computer program for accomplishing a specific
computing task.
a. Computer Programming c. Computer Engineering
b. Computer System d. Computer Troubleshooting

11. This executes a block of code if a specified condition is true. If the condition is false, another block of
code can be executed.
a. If-else statement c. For loop
b. Switch-case statement d. Nested loop
12. This statement tests the value of a variable and compares it with multiple cases. Once the case match is
found, a block of statements associated with that particular case is executed.
a. If-else statement c. Switch-case statement
b. Nested loop d. Break-default statement

13. ICT stands for?


a. Information and Computer c. Information and Communications
Technology Technology
b. Idea and Compilation Transmission d. Informative and Communicative
Technicality

14. It is a programming language conditional iterative statement which is used to check for certain conditions
and then repeatedly execute a block of code as long as those conditions are met.
a. Do-while loop c. For loop
b. Nested loop d. While loop

15. It is a control flow statement that executes a block of code at least once, and then repeatedly executes the
block, or not, depending on a given boolean condition at the end of the block.
a. For loop c. While loop
b. Nested loop d. Do-while loop

II – Find the error: In this program code, write the error and the correct answer in your test booklet. (30 points,
2 points each)

import java.util.Scnnr;

public class javaCalculator


{

public static void main(String args)


{
in num1;
int num2
String operation;

Scanner input = new Scanner(System);

System.out.println("please enter the first number");


n1 = input.nextInt();

System.out.println("please enter the second number");


num2 = input.NextInt();

Scanner op = new Scanner(System.in);

System.out.println("Please enter operation");


operation = operation.next();

if (operation = "+");
{
System.out.println("your answer is" + (num1 + num2);
}
else if (operation == ‘-‘);
{
System.out.println("your answer is" + (num1 - num2));
}

if (op == "/");
{
System.println("your answer is" + (num1 / num2));
}
else if (operation == "divide")
{
System.out.print("your answer is" (num1 * num2));
};

)
}
III – Written Code: Write a code that can output the following: (55 points)

Set A:

*
**
***
****
*****

Set B:

How many elements would you like to input?

Enter names of the field per element:

The Names are:

“Kung kamung duha naay FUNCTION, then it has a PARAMETER to provide then check if it is MATCH for equation for LOVE it is
possible to RETURN love or else RETURN 0 najud.”

- Master Zoilo, circa 2019, The Tales of an IT Instructor

Das könnte Ihnen auch gefallen