NEW
Font size
WorksheetsProblem Solving PP2
Total questions: 24
Worksheet time: 12mins
What is printed by the pseudocode if the input values are 5 and 2 respectively?
6
12
14
24
A complier is software that converts the
source code to assembly code
source code to machine code
program to output
program to object code one instruction at a time
The result of the expression 3 MOD 4 is
0
1
3
4
The variable total is assigned the value 12. Which output shows the CORRECT display when the code Write "total =", is executed
total =
12
total = 12
"total ="
Which of the following identifiers is a valid variable name?
Begin
iCount
Num-1
5Sum
Which of the following structures is most commonly used to implement a post-test
loop?
for -do
while-do
if-then
repeat- until
Which of the following is NOT a third- generation language?
Assembly
COBOL
C
PASCAL
Which of the following e true about the use of indentation in Programming?
I: To make the layout of the code attractive.
II: For compiler/interpreter to identify errors easily
III: For easy understanding of the order of code
IV: For easy correction of syntax errors
I, II and III only
I, III and IV only
II, III and IV only
I, II, III and IV only
The purpose of comments in program code is to
I. allow persons who read it to follow the processes
ll. know the purpose of the program
III. generate code
I, ll and lll
ll and III only
| and III only
I and II only
The following is a fragment of code.
For Discount=10 to 12 do
Write ('&&')
What is the output of the above fragment of code?
&&
&&&
&&&&&&
Nothing will be printed
The following is a fragment of code.
Count = 3
Discount = 0
While (Discount < Count) Do
Write('*');
Count := Count - 1
What is the output of this fragment of code?
**
***
****
There will be no output, because the code has an error.
Assigning 3.14 to pi( π ) means that pi should be declared as
integer
real
string
char
Which of the following statements includes loops
Sequencing
Repetition
Selection
Ordering
The missing entry in the truth table below is
1
T
F
0
The steps involved in problem-solving include
I. developing an algorithm
II. defining the problem
III. testing the solution
What is the correct order. of the steps listed above?
I, II, III
II,I, III
II, III, I
III, I, II
Step 2 in the above algorithm is an example of
input
processing
output
storage
Which of the steps in the above algorithm are examples of processing?
2 and 3
3 and 4
3 and 5
4 and 5
The integer variables a, b and c, are given the values 6, l0 and 2 respectively.
What is the result of the expression
a MULT (b DIV c)
0
20
30
120
The original code written by the programmer is termed
object code
source code
machine code
symbolic code
What is the value of X?
3
8
9
14
Which of the following series of numbers represents the correct output when the number 3 is input?
2,1,0
2,1,0,-1
2,1,0,-2
3, 2,1,0,-1
The structure below represents
sequencing
repetition
selection
ordering
How many times will the loop be executed by following statement?
FOR mark: = -1 to 5 DO
Write (‘^’);
-1
0
5
7
What is the output of the following algorithm?
A=5
B=4
REPEAT
PRINT A
A = A – 1
UNTIL A < 4
3,2
4,3
4,5
5,4
