Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MID-SEMESTER TEST

Total questions: 20

Worksheet time: 2hrs 40mins

Name
Class
Date
1.

Which of the following statements correctly define the use of variables?

a)

Use unique name.

b)

Use capital letters.

c)

Can start with a digit.

d)

Never use special characters.

2.

What is the purpose of control structures?

a)

To control input.

b)

To control the whole program.

c)

To specify when the program starts and shuts down.

d)

To specify what has to be done by the program, when and under which circumstances.

3.

Show which of the statements is best described the loop (repetition) control?

a)

One or more steps are performed repeatedly.

b)

Only one of a number of alternative steps is executed.

c)

Each step is executed exactly once during the algorithm.

d)

A set of rules to be followed in calculations or other problem solving operations.

4.

Identify the appropriate logical operators to be used if only one statement should be true?

a)

OR.

b)

AND.

c)

NOT.

d)

IF, THEN.

5.

What is the appropriate arithmetic operators to ask user to enter a number if the entered number is not equal to 0?

a)

num%0.

b)

num<=0.

c)

num==0.

d)

num!=0.

6.

You are required to find the quotient and the remainder after dividing a given number by 5. Which of these representation are correct?

a)

Quotient = number+5, Remainder = number-5.

b)

Quotient = number*5, Remainder = number/5.

c)

Quotient = number/5, Remainder = number%5.

d)

Quotient = number//5, Remainder = number||5.

7.

Find the value of this expression.


12 + 6.8 / 2 * 2

a)

4.

b)

9.

c)

13.

d)

18.

8.

Find the value of this expression.


8 % (5 % 3) + 5 * 2

a)

5.

b)

8.

c)

10.

d)

14.

9.

State whether the following expressions are true or false.


Expressions


1 == ( -1 + 5) % 3 X

(3 >= (2 * 2) ) && (5 <= 10) Y

(‘A’ <= ‘D’) || (5.0 > 5 ) Z

a)

True, true, false.

b)

True, false, true.

c)

False, false, true.

d)

False, false, false.

10.

Based on these expressions, what is the final answer for NOT X || Y && Z?


Expressions


1 == ( -1 + 5) % 3 X

(3 >= (2 * 2) ) && (5 <= 10) Y

(‘A’ <= ‘D’) || (5.0 > 5 ) Z

a)

True.

b)

False.

c)

NOT False.

d)

None of the above.

11.

Given the partial of program codes as in Figure 2.0 as follows:


int a, b;

double result;

a = 5;

b = 2;

a = a + 1;

result = a - b;

if result >= 0

print "Correct"


Identify the variable(s) used in this program?

a)

a, b.

b)

int, double.

c)

a, b, result.

d)

int, a, b, double, result.

12.

Based on this algorithm, determine the most suitable data type for result in line 2?


int a, b;

double result;

a = 5;

b = 2;

a = a + 1;

result = a - b;

if result >= 0

print "Correct"

a)

int.

b)

float.

c)

string.

d)

boolean.

13.

Based on this algorithm, by using the values of a and b at lines 3 and 4, show which one is false for the following statements.


int a, b;

double result;

a = 5;

b = 2;

a = a + 1;

result = a - b;

if result >= 0

print "Correct"

a)

a != b.

b)

a >= b.

c)

b == (a / b).

d)

(a % b) == b.

14.

Relate the output of the following segment if x is assigned the value -7?


if (x > 0)

count << "x is positive";

else if (x < 0)

count << "x is negative";

else

count << "x is 0";

a)

x is 0.

b)

x is -7.

c)

x is positive.

d)

x is negative.

15.

Represent the output of the segment, if x is assigned the value 1.


switch (x) {

case 1:

count << "x is 1";

break;

case 2:

count << "x is 3";

break;

default:

count << "value of x is unknown";

}

a)

x is 1.

b)

x is 2.

c)

x is 3.

d)

value of x is unknown.

16.

The flow chart shows a process of determining the 'Pass' or 'Fail' status based on some circumstances. Select the correct explanation for this situation

a)

Display 'Pass' if the marks obtained are equal to 50. Otherwise, display 'Fail'.

b)

Display 'Pass' if the marks obtained are more than 50. Otherwise, display 'Fail'.

c)

Display 'Pass' if the marks obtained are equal or less than 50. Otherwise, display 'Fail'.

d)

Display 'Pass' if the marks obtained are equal or more than 50. Otherwise, display 'Fail'.

17.

Identify the mistakes made in this flow chart?

a)

No changes should be made.

b)

The input/output should use parallelogram.

c)

The Start/End should be in capital letters.

d)

The arrow should be without direction.

18.

Constants are treated just like regular variables except that their values cannot be modified after their definition.

a)

True.

b)

False.

19.

Is the following statement an example of abstraction?


“When using a TV, you can turn it on and off, change the channel, adjust the volume, and add external components such as speakers, VCRs, and DVD players, BUT you do not know its internal details, that is, you do not know how it receives signals over the air or through a cable, how it translates them, and finally displays them on the screen”.

a)

True.

b)

False.

20.

Listed below are the five steps involved in problem solving:


(1) Developing the solutions;

(2) Coding and implementation;

(3) Understanding the problem;

(4) Test the solutions;

(5) Analyzing the problem.

Rearrange them in the correct order.

a)

(4); (3); (2); (1); (5).

b)

(2); (4); (3); (5); (1).

c)

(1); (4); (2); (5); (3).

d)

(3); (5); (1); (4); (2).