0% found this document useful (0 votes)
15 views

MC - Problem Solving Programming

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

MC - Problem Solving Programming

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

Problem Solving & Programming

Multiple Choice
Identify the choice that best completes the statement or answers the question.
1. The variable CustBalance stores the amount of 5. Which of the following algorithms satisfies the
money owed by customers. CustBalance is MOST requirement of asking the user to input two
likely of data type numbers, calculating the average and displaying the
result?
a. integer
b. character a. display ‘Enter two numbers’
c. real input a, b
d. array c  (a+b)/2
display c
2. Which of the following control structures is the
MOST appropriate for reading data from an array? b. input a, b
c  (a+b)/2
a. Sequence display c
b. Selection c. display ‘Enter two numbers’
c. Repetition input a, b
d. Recursion c  a+b/2
display c
3. Given the following algorithm
d. input a, b
c  a + b/2
j5
display c
kj
jj+k 6. Which of the following algorithms does NOT
kj+3 display four consecutive numbers?
display k
a. for v = 2 to 5
The value displayed for k is display v
a. 10 b. h  1
b. 11 while h < 5
c. 13 display h
d. 14 hh+1
end while
4. The following variables s, t and u have been
c. for k = 7 down to 4 step -1
assigned the values shown.
display k
s5
d. f  6
t6
while f < 3
u3
display f
ff-1
Which of the following statements does NOT
evaluate to true? 7. The variables h and s are assigned the following
values, h  4 and s  3 * h.
a. u > 7 and t <= 7 Display h + s * 2 will show
b. s < t or u < s - 2
c. u - 2 >= 1 a. 28
d. t <> 4 or s = 5 b. 30
c. 32
d. 38
a. write
8. Which of the following languages is only b. read
understood by computers? c. writeln
d. readln
a. 4 GLs
b. Machine languages 15. Program implementation involves a number of
c. Natural Languages steps. Which of the following steps is NOT
d. Procedural languages legitimate?
9. Which of the following languages is NOT a high- a. Executing
level language? b. Bonding
c. Compiling
a. C d. Linking
b. COBOL
c. ASSEMBLY 16. Which of the following identifiers is NOT a valid
d. PASCAL variable name?
10. Errors that occur in a program when the rules of the a. input
programming languages are NOT obeyed are called b. totalCost
c. 9Count
a. Syntax errors d. NumCount
b. Logical errors
c. Execution errors 17. The term used to describe a memory location
d. Run-time errors whose value changes during program execution is
11. Which of the following is NOT a type of program a. constant
error? b. volatile
c. variable
a. Logic error d. dynamic
b. Syntax error
c. Run time error 18. Consider the following algorithm.
d. Debug error
A7
12. Which of the following is not a term used to B9
describe the process of manually going through a AB-A
program looking for errors? BA+B
Write A, B
a. Tracing
b. Dry run The output of this algorithm is
c. Debugging
d. Documentation a. 2, 9
b. 2, 11
13. Which of the following is an example of a
c. 7, 9
conditional construct?
d. 7, 11
a. For-Next 19. Consider the following algorithm
b. If-Then-Else
c. While-Endwhile Sum  0
d. For-Endfor Read a, b
Sum  a+b
14. Which of the following reserved words in Pascal
Write Sum
displays data and places the cursor on a new line?
24. Which of the following is NOT a third-generation
In the above algorithm, ‘sum  0’ represents language?

a. a declaration a. Assembly
b. a computation b. COBOL
c. an initialization c. C
d. an assignment d. PASCAL
20. In the programming language Pascal, which of the 25. The Pascal code var x, y would generate an error.
following is NOT a standard data type? The term used to describe this type of error is

a. Floating point a. run time error


b. Char b. execution error
c. Boolean c. logical error
d. Integer d. syntax error
Item 26 refers to the following pseudocode
21. Which of the following structures is most
commonly used to implement a post-test loop in
Read A, B
Pascal?
If A < 2
C2
a. for-do
Else
b. while-do
C6
c. if-then
End if
d. repeat-until
D  C*B+2
22. The purpose of comments in program code is to Write D
26. What is printed by the pseudocode if the input
I. allow persons who read it follow the values are 5 and 2 respectively?
processes
II. know the purpose of the program a. 6
III. generate code b. 12
c. 14
a. I and II only d. 24
b. I and III only
27. A compiler is a software that converts the
c. II and III only
d. I, II and III
a. source code to assembly code
23. Which of the following are true about the use of b. source code to machine code
indentation in programming? c. program to output
d. program to object code one instruction at a time
I. To make the layout of the code attractive
28. The result of the expression 3 mod 4 is
II. For compiler/interpreter to identify errors
easily
a. 0
III. For easy understanding of the order of code
b. 1
IV. For easy correction of syntax errors
c. 3
d. 4
a. I, II and III only
b. I, III and IV only 29. Which of the following symbols is used to perform
c. II, III and IV only assignments in the programming language Pascal?
d. I, II, III and IV
a. =
b. 
c. := c. Repeat (write(“Yes”)) until (Answer <10)
d. = = d. Answer := answer/(10-10)
30. The variable total is assigned the value 12. Which 36. At which stage of program development should
output shows the CORRECT display when the desk checking be included?
Pascal code writeln(‘total = ’); is executed?
a. After the debugging phase
a. total = b. During the design phase
b. 12 c. During the testing phase
c. total = 12 d. At every phase
d. ‘total = ’ Items 37 - 38 are based upon the following
declarations in Pascal.
31. Which of the following identifiers is a valid
variable name?
Var Count : Integer;
Price : Real;
a. Begin
Discount : Integer;
b. iCount
37. The following is a fragment of code.
c. Num-1
d. 5Sum
Count := 3;
32. Which of the following statements would be placed Discount := 0;
in the flowchart box shown below? While (Discount < Count) Do
Begin
Write(‘*’);
Count := Count - 1;
End

What is the output of the above fragment of code?


a. Read A
b. A > 25 a. **
c. Count  Count + 1 b. ***
d. Output C c. ****
d. There will be no output, because the code has
33. The first-generation programming language is
an error.
called
38. The following is a fragment of code.
a. Assembly
b. BASIC For Discount := 10 to 12 Do
c. Machine
d. Non-procedural Write(‘&&’)
34. Errors that result from NOT following rules of the
What is the output of the above fragment of code?
programming language are called
a. &&
a. execution errors
b. &&&
b. logic errors
c. &&&&&&
c. run-time errors
d. Nothing will be printed.
d. syntax errors
39. In Pascal, the symbol <> means
35. An example of a run-time error is
a. less than and greater than
a. If (Answer<10) then writeln(‘Yes’)
b. less than or greater than
b. While (Answer 12) Do write(‘Yes’)
c. equal to For x := 1 to 5 Do
d. not equal to ITEM[x] := 0;
46. The purpose of the Pascal code is to
40. In Pascal, what does COUNT represent?
a. Place x in ITEM
a. An assignment b. Place 0 in ITEM
b. A condition c. Place 1 to 5 in x
c. A declaration d. Place the numbers 1 to 5 in ITEM
d. A variable
47. Which of the following statements includes loops?
41. Assigning 3.14 to pi() means that pi should be
declared as a. Sequencing
b. Repetition
a. integer c. Selection
b. real d. Ordering
c. string
d. char
42. How many times will the following loop be
executed?

for mark := 0 to 2 do
writeln(‘*’);

a. 0
b. 2
c. 3
d. 4
43. The function of a compiler is to convert

a. program code line by line


b. an entire program
c. a program efficiently
d. the language to source code
44. The LAST step in solving a program is to

a. evaluate solutions
b. test the solution
c. develop the algorithm
d. specify and design
45. The Pascal term used to see results on the printer or
computer monitor is called

a. input
b. read
c. write
d. output
Item 46 is based on the Pascal code below.
Problem Solving & Programming
Answer Section

MULTIPLE CHOICE
1. ANS: C PTS: 1 NOT: CSEC Specimen 2008
2. ANS: C PTS: 1 NOT: CSEC Specimen 2008
3. ANS: C PTS: 1 NOT: CSEC Specimen 2008
4. ANS: A PTS: 1 NOT: CSEC Specimen 2008
5. ANS: A PTS: 1 NOT: CSEC Specimen 2008
6. ANS: D PTS: 1 NOT: CSEC Specimen 2008
7. ANS: A PTS: 1 NOT: CSEC Specimen 2008
8. ANS: B PTS: 1 NOT: CSEC Specimen 2008
9. ANS: C PTS: 1 NOT: CSEC Specimen 2008
10. ANS: A PTS: 1 NOT: CSEC Specimen 2008
11. ANS: D PTS: 1 NOT: CSEC Specimen 2008
12. ANS: D PTS: 1 NOT: CSEC Specimen 2008
13. ANS: B PTS: 1 NOT: CSEC Specimen 2008
14. ANS: C PTS: 1 NOT: CSEC Specimen 2008
15. ANS: B PTS: 1 NOT: CSEC Specimen 2008
16. ANS: C PTS: 1 NOT: CSEC Specimen 2008
17. ANS: C PTS: 1 NOT: CSEC Specimen 2008
18. ANS: B PTS: 1 NOT: CSEC June 2010
19. ANS: C PTS: 1 NOT: CSEC June 2010
20. ANS: A PTS: 1 NOT: CSEC June 2010
21. ANS: D PTS: 1 NOT: CSEC June 2010
22. ANS: A PTS: 1 NOT: CSEC June 2010
23. ANS: B PTS: 1 NOT: CSEC June 2010
24. ANS: A PTS: 1 NOT: CSEC June 2010
25. ANS: D PTS: 1 NOT: CSEC June 2010
26. ANS: C PTS: 1 NOT: CSEC June 2010
27. ANS: B PTS: 1 NOT: CSEC June 2010
28. ANS: C PTS: 1 NOT: CSEC June 2010
29. ANS: C PTS: 1 NOT: CSEC June 2010
30. ANS: A PTS: 1 NOT: CSEC June 2010
31. ANS: B PTS: 1 NOT: CSEC June 2010
32. ANS: C PTS: 1 NOT: CSEC June 2010
33. ANS: C PTS: 1 NOT: CSEC June 2011
34. ANS: D PTS: 1 NOT: CSEC June 2011
35. ANS: D PTS: 1 NOT: CSEC June 2011
36. ANS: C PTS: 1 NOT: CSEC June 2011
37. ANS: B PTS: 1 NOT: CSEC June 2011
38. ANS: C PTS: 1 NOT: CSEC June 2011
39. ANS: D PTS: 1 NOT: CSEC June 2011
40. ANS: D PTS: 1 NOT: CSEC June 2011
41. ANS: B PTS: 1 NOT: CSEC June 2011
42. ANS: C PTS: 1 NOT: CSEC June 2011
43. ANS: B PTS: 1 NOT: CSEC June 2011
44. ANS: C PTS: 1 NOT: CSEC June 2011
45. ANS: C PTS: 1 NOT: CSEC June 2011
46. ANS: B PTS: 1 NOT: CSEC June 2011
47. ANS: B PTS: 1 NOT: CSEC June 2011

You might also like