You are on page 1of 8

l. What is the LARGEST integer that can be 6.

Whattype ofcomputer system is usually used


a
represented in a 4-bit signed magnitude? for weather forecasti ng?

(A) +3 (A) Micro computers


(B) +7 (B) Work stations
(c) +8 (C) Mainframe computers
(D) +ls (D) Super computers

7. The range of instructions that a computer can


2. What is the 4-bit two's complement of 8?
execute is known as the
(A) Oilr
(B) (A) instruction set
1010
(c) (B) instruction size
1000
(D) l0l r
(c) executable instructions
(D) word size

'Flash memory' is a type of


Which of the following devices is.used to

-b
E.
(A) ROM store permanent binary information?
(B) RAM
(c) EEPROM (A) ROM
(D) EPROM (B) RAM
(c) PROM
(D) EPROM
4. What is the 8-bit sign and magnitude
representation of the decimal number - 29? 9. Which of the following statements about
flip-flops are TRUE?
(A) 000r0llr
(B) 0001 r r 0 r I. Flip-flops are examples ofdefective
(c) l00l0rrl logic circuits.
(D) r 00 | l r 0l II. Flip-flops are-two-state devices that
can only store I's and 0's.
III. Registers are made up offlip-flops.
f,. What is the purpose of the fetch part of the
fetch-decode-execute cycle in a computer? (A) I and II only
(B) I and III only
(A) Obtaining an instruction from (C) II and III only
memory (D) I,ll and III
(B) Determining what the operands are
(C) Determining what the operation is
(D) Performing a task to get the results 10. Apopular scheme for representing characters
is

(A) Word size


(B) Flip-flop
(c) ASCII
(D) Logic gate

GO ON TO THE NEXT PAGE


021r5010/CAPE 2015
Item 11 refers to Figure t andrFigure II.

A B F
0 0 0
0 I 0
I 0 0
t I I
Figure I Figure II
pigure

11. The symbol that should replace the box in Figure I

-r>
is

aJ 4J -f)*-
1:- -T)*
4J
I ;] III IV

(A) I
(B) rr
(c) rrr I
(D) rv
I

f
Items 12-13 refer to the fol lowing components. . 14. Which ofthe followingstatements about logic
gates are FALSE?
(A) ALU ?

(B) cu I. A NOT gate can have one or more


(C) Registers f inputs, but only one output.
(D) RAM i II. A NOR gate can have only one
input and only one output.
Match EACH item below with ONE of tne -$,1
UI. A NOR gate can have oni or more
components above. Each option may be used ,
inputs, but only one output.
once, more than once, or not at all-
: (A) I and II onty
t2. Which ofthe components handles statements (B) I and III only
such as "lfx < 0"? (C) II and III onty
(D) I, II and III
13. Which of the components coordinates the
saving of a file to a hard drive?

GO ON TO THE NEXT PAGE


02t 15010/CAPE 2015
, 15- Which ofthe following components consists 17. Which of the the following flowcharts
ofvery hfgh speed tn"tnolyii corresponds to the algorithm?

(A) ALU
(B) CU (A)
(C) Registers
(D) RAM

Items 16-17 referto the following algorithm.

if a:: b then
print (*Equal")
elseifa>bthen
print ("A is larger")
else
(B)
print ("8 is larger")
End if
.*

What is the output generated by the algorithm


if a is l5 andbis22?

(A) A is larger

(B) A is larger
B is larger
(c)
Equal
{cl
(D) B is larger

(D)

i..
ll
I
ll
i!
i
ir
i_
R'
i,
!
i
il

t,
i,
v
r..
t;

GO ON TO THE NEXT PAGE Yi:


!.,r
02rl50r0lcAPE 2015
'!t

;'
.t....
,t:;;
g.
Item lE refers to the:following flowchart Item 23 refers to the following algorithm
symbol. which counts and displays the number
of votes obtained by l0 candidates in an
election. Each vote is input as a number
between I and 10, corresponding to one of
the candidates. Data are terminated bv zero.

18. The symbol represents for i :0 to 9 begin

(A)
tx)
a decision box end for
(B) an inpuVoutput box read vote
(C) a process box while (vote ! :0) begin
(D) a terminator tY)
read vote
end while
19. Which of the following control structures for i= 1 to l0
can be used when attempting to read data print ( "Votes obtained by
from a file where the number of records is candidate" +i "is")
not known? {z)
end for
(A) A'for" loop
(B) A sentinel control loop
(C) A switch control structure 23. Which of the following BEST represents X,
(D) An "lf.-..else" control structure Y and Zinthe algorithm above?

(A) X: arr[0]: i
Items2h22 refer to the following options. Y: arr[vote] : arr[vote - l] +l
Z: print (an [i])
(A) Assignment
(B) Unbounded iteration (B) X: arr [0]: i
(C) Ouput Y: arr [vote -l] : arr[vote - l] +l
(D) Bounded iteration Z: pfint (an [i - l])

Match EACH item below with ONE of the (C) X: arr [i]: O
options above. Each option may be used Y: arr [vote -l]: arr [vote - l] +l
more than once, once or not at all. Z: print (anli-ll)

20. for(i:0;icn;+i) (D) X: arr [i]:0


Y: arr [vote] : arr [vote - l] +l
21. arr[]=arr[]+3 Z: print (arr [i])

)7 while ((c: getcha()) ! :'\0')

GO ON TO THE NEXT PACE


02115010/CAPE 201s
. 24. In the 'lmplementation and.Relierv'stage of Item 26 refers to the following algorithm.
the problem:solving, process, implementation
involves the Fory: I to3
Forz= | toy
(A) installation of softrvare Print (*r'";
(B) analysis of the problem End for
(C) evaluation of alternative solutions Println ("")
(D) writing of algorithms End for

(l ) Print displays output to the scr€en


Item 25 refers to the following flowchart. (2) Println displays outputto the screen
and every subsequent output begins
on a new line.

26. The output of this algorithm is

(A) *
*:f :f !F*

(B) ***
**
*

(C) **{'***

(D) :F

**
**.*
25. The symbol represented by 'P' can be
replaced with the statement

(A) Read x
(B) Isx<0?
(c) x:2*x
(D) 5*y

GO ON TO THE NEXT PAGE


021150r0/CAPE 20ls
Items 27 18 refer to the fol lowing algorithm.
30. The following algorithm is needed to
irint
halfthe sum oftwo positive integers entered
num: I
by the user.
n:0
WHILEn<5do (l) Read A
num=num+n
n: nt2 @ Read B
(3) Sum :
(B + A)/2
( PRINT num (4) Print.Sum is, sum'
ENDWHILE
(
Which line contains an error?
27. What is the output produced by the algorithm?

(A) (A) Line I


123 (B) Line?
(B) 124 (C) Line 3
(c) r37 (D) Line 4
(D) l3s
28. What is the ouputproduced bythe algorithm 31. Given a variable .num'declared as follows:
if n is initialized to I and num is iniiialized double num;
to 5?
Which of the following statements will
(A) s8 correctly read a value entered by a user into
(B) 68 'numt?
(c) 6e
(D) se (A) scanf ("o/od", num);
(B) scanf (..oAd", &num);

Item 29 refers to the following algorithm


(C) scanf (,,%olf .,, num);
written in pseudocode.
(D) scanf (.,o/olf .,, &num);

set number to I 32. Which of the following allows previously


set counter to 20
compiled modules to be combined with a
do
compiled program to generate an executable
if number %o2: I file?
print number
end if (A) Linker
increment number by 2
while number (: (B) Translator
counter (C) Compiter
(D) .Program
NB x Yo y is the remainder when x is
divided byy.

29. Whic-h ofthe following will be printed by the


pseudocode above?

(A) 3s79tl l3 ts t7 19
(B) 3s7911 13 15 l7 l9 2l
(c) 13s7e il1315t7t9
(D) t3s79 lt 13 t5 t7 19 2l

GO ON TO THE NEXT PAGE


0zrls0t0/cAPE 20ls
- 33, To execute a computer progrqqn,,written in a 37. What output would you expect from the
high-level language:it must be converted into following program?

(A) object code # include <stdio.h>


(B) source code main ( )
(C) assembly language t
(D) machine,language g b;
int
a=5;
b= l0;
34. In the C programming language, what data printf ("The value of a is o/0d", b);
type should be used to store a currency value printf (\n Goodbye");
in a program? )

(A) Long (A) The value of a is 5


(B) Double Goodbye
(C) Integer
(D) Alphanumeric (B) The value of a is 5
\n Goodbye

35. Which of the following is NOT a valid (c) The value of a is l0 \n Goodbye
identifier for a variable?
(D) The value of a is l0
(A) _hello Goodbye
(B) 2ndmark
(C) marker 2
(D) SUM4
Item 38 refers to the following lines ofcode.

int i, sum;
sum = 5;
Item 36 refers to the code below.
for (i = 4;i> l; i--)
int a, b, c
sum=sum*i;
printf ("sum is Yod",sum);
a: l;
(i= l; i< 5; i+r)
for
a=a* i; 38. What is the output generated when the lines
b=a*5; ofcode are executed?

36. What is the value of a after execution of the (A) Sum is 5.


code? (B) Sum is 14.
(C) Sum is 15. i
(A) 5 (D) Nothing is generated. I
(B) I
(c) 24
(D) 39. Typically, a variable that is declared in a
t20
function is accessible

(A) within the whole file


(B) within the function and main ( )
only
(c) from the calling function
(D) within the function only

GO ON TO THE NEXT PAGE


02r tsol0/CAPE 20rs
., , 40. souree t
What are the values of a,,g 4n6 C after the 43. Which ofthefollowingtranslatesthe
. following code is executed? ode of a program, one line at a time? !

intA, B, C; (A) Assembler


A : l0; (B) Interpreter
B:2Oi (C) Linker
C:A; (D) Compiler
A: B;
B: C;
Item 44 refers to the following scenario.
. (A) A:20; B = l0; C: l0
(B) A : l0; B :20i C = 20 A text file, data.bct, contains several lines
. (C) A: l0; B:20; C: l0 of data. Acertainprogramopensthisfile
(D) A:20i B: l0; C:20 as follows:

FILE tfp: fopen ("data'blt", "*");


Item 41 refers to the following information.
44. An integer variable, x, has a certain value.
' Error (a) - a closed parenthesis is omitted Which of the following statements can be
from an expression used to store the value of x in the file?

Error (b) - a value of a wrong type is assigned (A) fp = fprintf ("Yod" , x);
to a constant (B) fprintf (..data.txt'', ..o/od',, x);
(C) Srintf (fp, "%od",x);
- 4L At which stage ofcompilation will errors (a) (D) fprintf ("Zod", x);
and (b) be detected?

(A) (a) lexical (b) syntax 45. You write a program to compute the day of
. (B) (a) syntax (b) lexical the week on which a given date will fall but
(C) (a) semantic (b) code generation forgot to consider leap years. Which of the
(D) (a) lexical (b) semantic following types of errors will your program
contain?

42. The following statement refers to the C (A) Syntax


programming language. Complete the (B) Logic
statement as best as possible. (C) Run-time
(D) Omission
A large program is easier to debug if it is
decomposed into a set of

(A) objects
(B) variables
(C) functions
(D) structures

END OF TEST

IF YOU F"INISH BEFORE TIME IS CALLED, CIIE',CK YOUR WORK ON THIS TEST.

02r r501o/CAPE 20rs

You might also like