0% found this document useful (0 votes)
31 views12 pages

CompSci U1 P1 2020

Uploaded by

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

CompSci U1 P1 2020

Uploaded by

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

CANDWAIE PLEASE NQIE!

lO
021150
pRJNT your name on the line below and return
this booklet with your answer sheet. Failure to TEST CODE
do so may result in disqualification.

FORM TP 2020202 l==================::==.I MAY/JUNE 2020


CARIBBEAN EXAMINATIONS COUNCIL
CARIBBEAN ADVANCED PROFICIENCY EXAMINATION®
COMPUTER SCIENCE
UNIT 1 - Paper 01
1 hour 30 minutes

( 01 JUNE 2020 (a.m.))

READ THE FOLLOWING INSTRUCTIONS CAREFULLY.

l. This test consists of 45 items. You will have l hour and 30 minutes to answer them.

2. In addition to this test booklet, you should have an answer sheet.

I
3. Do not be concerned that the answer sheet provides spaces for more answers than there are items
in this test.

4. Each item in this test has four suggested answers lettered (A), (B), (C), (D). Read each item you
are about to answer and decide which choice is best.
5. On your answer sheet, find the number which corresponds to your item and shade the space having
the same letter as the answer you have chosen. Look at the sample item below.

Sample Item

How many selection lines does an 8 x 1 multiplexer have? Sample Answer

(A) 1
(B) 2
(C) 3
(D) 8

The best answer to this item is "3", so (C) has been shaded.

6. If you want to change your answer, erase it completely before you fill in your new choice.

7. When you are told_ to begin, turn the page and work as quickly and as carefully as you can. If you
cannot answer an item, go on to the next one. You may return to that item later.

8. You may do any rough work in this booklet.

9. Figures are not necessarily drawn to scale.

10. The use of silent, non-programmable calculators is allowed.

DO NOT TURN TIDS PAGE UNTIL YOU ARE TOLD TO DO SO.

Copyright© 2019 Caribbean Examinations Council


All rights reserved.
02115010/MJ/CA PE 2020
-2-

. the following features is NO_T


5. Which of f torage devices over mam
1. When a computer program is executing an advantage o s
there are some instructions which need to memory?
be quickly retrieved. In which location are
the instructions MOST likely to be placed? Less volatility
(A)
Greater probability
(B)
(A) Hard drive Greater response tim~
(C)
(B) Floppy disk Larger storage capacity
(D)
(C) Cache memory
(D) Random access memory
What type of computer s~st~m is usually
6.
used for weather forecasting•
2. What is the LARGEST integer that can be
represented in a 4-bit signed magnitude?
(A) Mainframe computer
(B) Super computer
(A) +3
(C) Micro computer
(B) +7
+18 (D) Work station
(C)
(D) +15

7. ' Flash memory ' is a type of


3. The CPU deals with each instruction in
a cycle. The sequence of steps to carry (A) EEPROM
out one machine instruction is called the (B) EPROM
instruction or machine cycle. The first (C) RAM
action is to fetch the instruction and then (D) ROM
the program counter is updated. The other
three phases of the machine cycle in the
correct order are 8. The 8-bit sign and magnitude representation
of a certain number is 100IO101.
(A) decode the instruction; execute the
instruction; transfer the data What is the decimal number represented?
(B) decode the instruction; transfer the
data; execute the instruction (A) - 12
(C) execute the instruction; decode the (B) - 2l
instruction; transfer the data (C) 148
(D) transfer the data ; execute the (D) 149
instruction; decode the instruction

9. What is th e name of the combinational


4. What is the 4-bit two's complement of- 8? circuit which converts binary information
fro_m n coded inputs to a maximum of 2n
(A) I OO 0 unique outputs?
(B) I OI 0
(C) 0I 11 (A) Encoder
(D) I OI I (B) Decoder
(C) Logic gate
(D) Multiplexer

3. 0 2 l I 5010/MJ/CAPE 2020 GO ON TO THE NEXT PAG E


I I • ••

--
-3-

10. The range of instructions that a computer 12. Which of the following statements about
can execute is known as the flip-flops are true?

(A) executable instructions 1. Flip-flops can be used for data


(B) instruction size storage.
(C) instruction set 11. Flip-flops are two-state devices that
(D) word size can only store l 's and O's.
Ill. Registers are made up of flip-flops.

Item 11 refers to the following flowchart. (A) I and II only


(B) I and Ill only
START (C) II and III only
(D) I, II and III

Item 13 refers to the following program


p
segment written in low-level instructions.

LOAD X I I load contents of X to


accumulator register

ADD inc II add contents of inc to


accumulator register

STORE X II store contents ofaccumulator


register to X

STOP
13. Which address instruction format is used
by the computer?
11. Which of the following statements can be
placed in the symbol represented by P? (A) Zero address
(B) One address
(A) 5*y (C) Two address
(B) ls x < 0 (D) Three address
(C) Read x
(D) X=2 *X

GO ON TO THE N EXT PAGE


02 l 150 I 0IMJICAPE 2020
-4-
refer to the following algo-
Items 17- 18
-
Which of the following components consist rithm.
14.
of very high-speed memory?
I. p == l
cu While p < > 12 do
(A) II.
AL U product == P * P
(B) Ill.
(C) RAM IV. print (product)
(D) Registers V. p::::P+ 1
VI. End While

15. Which of the following statements about


logic gates are FALSE? The algorithm above BEST illustrates an
17.
example of using
I. A NOT gate can have one or more
inputs, but only one output. (A) input and output commands
11. A NOR gate can have only one
(B) a selection statement
input and only one output.
(C) test last iteration
III. A NOR gate can have one or more
(D) test first iteration
inputs, but only one output.

(A) I and ll only Which of the following BEST describes


I and Ill only 18.
(B) the type of statement used in line V?
(C) II and III only
(D) I, ll and IJl
(A) Conditional statement
(B) Incremental statement
(C) Variable declaration
16. In the 'Implementation and Re v iew '
stage of the problem-solv ing process, (D) Recursion
implementation invo lves the

writing of algorithms 19. Wh ich of the following control structures


(A)
analysis of the problem can be used when attempting to read data
(8)
installation of software from a file where the number of records is
(C)
(D) evaluation of alternative solutions not known?

(A) Afor loop


(8) A sentinel control loop
(C) Switch control structure
(D) An " IL.else" control structure

021 150 10/MJ/CAPE 2020 GO ON TO THE N EXT PAGE

ru
w
-5-

Item 20 refers to the following algorithm.

num=5
n=l
While n < 5 do
num =num + n
n=n+2
PRINTnum
End While

20. What is the output produced by the algorithm?

(A) 5 8
(B) 5 9
(C) 6 8
(D) 6 9

02115 0 I 0/MJ/CAPE 2020 GO O~ TO THE ~EXT PAGE


-6-

Item 21 refers to the following scenario.


Margaret works in the accounting department of a large store. She has to write an algorithm that
assigns a discount to products based on the price of the product, as shown below.

Discount
Product Price($) (% )
From IO to 29 inclusive 5
From 30 to 59 inclusive 10
From 60 to 89 inclusive 13
90 or above 15

W_hich of the following algorithms will assign the discount price to a product for a given product
21.
price?

(I) If (price 2:. 90)


price = price - (price*0.15)
Else _if (pric~ .:S 89 AND price 2:. 60)
pnce = pnce - (price*0.13)
Else_ if (price .:S 59 AND price 2:. 30)
pnce = price - (price*0.10)
Else_if (price .:S 29 AND price 2:. 10)
pnce = price - (price*0.05)

(U) If (price 2:. 10)


price = price - (price*0.05)
Else if (price 2:. 30)
price = price - (price*0. l 0)
Else if (price 2:. 60)
price = price - (price*0.13)
Else
price = price - (price*0.15)
End if
End if
End if

(Ill) If (price 2:. 10)


price = price - (price*0.05) end if
If (price 2:. 30)
price= price - (price*0. l 0) end if
If (price 2:. 60)
price= price - (price*0. 13) end if
If (price 2:. 90)
price= price - (price*0.15)
End if

(A) I only
(B) II only
(C) I and III only
(D) II and III only

GO ON TO THE NEXT PAGE


02 1150 I 0/MJ/CAPE 2020
- 7-

Hem 22 refers to the following algorithm. 23. The following algorithm is needed to
print half the sum of two positive integers
For y = 1 to 3 entered by the user.
For z = Ito y
Print ("*") Line
End For (I) Read A
Println ("") (2) Read B
End For (3) Sum= (8 + A)/2
(4) Print ' Sum is, sum'
( 1) Print displays output to the screen
(2) Println displays output to the screen Which line contains an error?
and every subsequent output begins
on a new line. (A) Line l
(8) Line 2
(C) Line 3
22. The output of this algorithm is (D) Line 4

(A)

(B)

(C) ******

(D) *
**
***

Item 24 refers to the following algorithms.

Algorithm I Algorithm Il Algorithm ill


X =2 X=2 X =2
For i = 1 to 500 Repeat While X> 75
X=X+ l X=X+ I X= X+ 1
End For Until X = 75 End While

24. If the algorithms were to be arranged such that the final values of X are in ascending order after
completion, then the order of the a lgorithms would be

(A) I, 11, Ill


(B) I, Ill, II
(C) III , I, II
(D) 111, II , I

GO ON TO THE NEXT PAGE


0211 50 J 0/ MJ/CAPE 2020
-8-

Item 27 refers to the following algorithm .


Items 25-26 refer to the following algo-
rithm.
Begin
total marks = 0 x=2
num marks = 0 y=6
end of data = - I Whiley> x
Read mark Printy
While mark <> end of data do y=y-2
total_marks = total_marks + mark End While
num_ marks = num_marks + I Printy
Read mark End
End While
avg_mark = total_ marks/num_marks
Print num_ marks, total_ marks, avg_marks 27. Which of the following sets of values
represents the output of the algorithm?

25. Which of the following programming (A) 6,4, 2


constructs is used in the algorithm above? (B) 6,4,4
(C) 6,4, 2,0
(A) Unbounded iteration (D) 6,4,2,2
(B) Bounded iteration
(C) Recursion
(D) Selection

26. What is the output when the algorithm is


executed with the following input values?

45, 56, 79, 84,-1, 76,31

(A) 4,266,64
(B) 4,264, 66
(C) 5, 371 , 92
(D) 5, 370, 93

0 2 l l 5010/MJ/CAPE 2020
GO ON TO THE NEXT PAGE
-9-

Item 28 refers to the following algorithm Item 29 refers to the following algorithm
which counts and displays the number written in pseudocode.
of votes obtained by ten candidates in an
election. Each vote is input as a number set number to 1
between one and ten, corresponding to one set counter to 20
of the candidates. Data are terminated by Do

l zero. If number% 2 == l
Print number
increment number by 2
J For i = 0 to 9 begin
{X} While number<= counter
End For
Read vote NB x % y is the remainder when x is
While (vote ! = 0) begin divided by y.
{ y}
Read vote
End While 29. What output will be printed by the
For i = 1 to 10 pseudocode above?
Print ( "Votes obtained by
candidate" +i " is") (A) 3 5 7 9 11 13 15 17 19
{ z} (B) 3 5 7 9 11 13 15 17 19 21
End For (C) 1 3 5 7 9 11 13 15 17 19 21
(D) l 3 5 7 9 11 13 15 17 19

28. Which of the following BEST represents


X , Y and Z in the algorithm above?

(A) X: arr[0] = i
Y: arr[vote] = arr[ vote - 1] + l
Z: Print (arr [i])

(B) X: arr [0] = i


Y: arr [vote - I ] = arr[vote - l ] + l
Z: Print (arr [i - I])

(C) X: arr [i] = 0


Y: arr [vote - 1] = arr [vote - 1] + 1
Z: Print (arr[i - I])

(D) X: arr [i] = 0

l Y: arr [vote]= arr [vote - I ] +I


Z: Print (arr [i])

GO ON TO THE NEXT PAGE


02 1150 I 0/MJ/CAPE 2020
- IO -

In the C programm ing language, what data


Consider the following three algorithms 32.
30. type should be used to store a currency
which will print a sequence of numbers.
value in a program?
I. x=4
(A) Long
While (x < 5) do
(B) Double
{
(C) Integer
Print the value of x
(D) Alphanumeric
x=x+I
}
Items 33_34 refer to the following code
JI. X =3 segment where ' % ' is the modulus operator.
While (x < 4) do
{
x = x+I
I. int num [5] = {1,9,8,2, 11 };
Print the value of x II. int x = num [O];
} Ill. int r;
IV. int sum = O;
JJI. X =4 V. For ( r = 0; r < 5; r++) {
Repeat { VI. If(num [r] %2 = = 0) && (num[r]<
Print the value of x x)
x=x+ 1 VII. sum= sum+ num [r];
} VIII. x = num [r] ;
Until (x > 5) IX. }

Which of the algorithms will print the


SAME sequence of numbers? 33. What is the value of the variable sum when
the 'for' loop terminates?
(A) land II only
(B) I and Ill only (A) 0
(C) II and Ill only (B ) 8
(D) I, II and III (C) 10
(D) 14

31. Which of the following allows previously


compiled modules to be combined with a 34. What value will be stored in the variable
compiled program to generate an executable sum when the following is done?
file ?
Change the if condition in line VI to
(A) Linker if (num [r] %2 = = I) && (num [r] > x).
(B) Translator
(C) Compiler (A) IO
(0) Program (B) 15
(C) 21
(D) 20

02115010/MJ/CAPE 2020 GO ON TO THE NEXT PAGE


- 11 -

Item 35 refers to the following array and


code segment where '%' is the modulus Items 38 3 9 refer to the following code
segment.
operator.

0 2 3 4 L~ne 1: double num I == 5.6;


5 6
L'.ne 2: double num2 == 3.0;
23 45 27 34 56 92 L~ne 3: double product== 1.0;
L'.ne 4: While (product< 50) {
Lme 5: printf ("The new product is
inti ; //Li ne I . %d\n", product);
For (i = 0 ; i < 7; i = i + I) { //L ine 2 Lme 6: product= product* num2·
int num = arr (i] ; //L ine 3 Line 7: } '
If (num% 2! = 0) //L ine 4
printf ( "%d ", num); //Line 5
} //L ine 6 38. Which line of the above code segment will
produce a run-time error?

35. What output is printed by the code segment? (A) 6


(B) 5
(A) 45 34 1 (C) 3
(B) 34 56 92 (D)
(C) 23 27 56 92
(D) 23 45 27 I
39. Assuming that the error is corrected, how
many lines of output would be produced
36. The name given to the variable x when by the code segment?
defining the function display Data (int x) is
(A) 1
(A) formal parameter (B) 3
(B) passed parameter (C) 4
(C) actual parameter (D) 50
(D) sent parameter

40. A programming paradigm that models


Item 37 refers to the following code. real-world entities w ith attributes and
behaviours is
int a, b, i;
a= 1; (A) scripting
For ( i = I ; i < 5; i + +) (B) fu nctional
a= a* i; (C) procedural
b =a* 5; (D) object-oriented

37. What is the value of a after execution of


the code?

(A) 5
(B) 8
(C) 24
(D) 120

GO ON TO THE NEXT PAGE


02 115010/ MJ/CAP E 2020
- 12 -

41. An integer variable, x, has a certain value. 44. The following incomplete statement refers
Which of the following statements can be to the C programming language. Complete
used to store the value of x? the statement as best as possible.

(A) fp = fprintf ("%d", x); A large program is easier to debug if it is


(B) fprintf (fp, "%d", x ); decomposed into a set of
(C) fprintf ("data.txt" , "%d", x) ;
(D) fprintf ("%d", x ); (A) objects
(B) variables
(C) functions
42. A user wishes to declare a variable in C (D) structures
that can store the square root of an integer.
Which of the following is the MOST
appropriate declaration? 45. You write a program to compute the day
of the week on which a given date will fall
(A) double num; but forget to consider leap years. Which
(B) char num [IO] ; of the following types of errors will your
(C) char num ; program contain?
(D) int num;
(A) Syntax
(B) Logic
Item 43 refers to the following lines ofcode. (C) Run-time
(D) Omission
inti, sum;
sum= 5;
For(i= 4; i> l ; i --)
sum = sum+ i;
printf ("Sum is %d", sum);

43. What output is generated when the lines of


code are executed?

(A) Sum is 15.


(B) Sum is 14.
(C) Sum is 5.
(D) Sum is 4.

END OFTEST

IF YOU FINISH BEFORE TIME IS CALLED, CHECK YOUR WORK


ON THIS TEST.

02 I l SO I 0/MJ/CAPE 2020

You might also like