CompSci U1 P1 2020
CompSci U1 P1 2020
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.
l. This test consists of 45 items. You will have l hour and 30 minutes to answer them.
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
(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.
--
-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?
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
ru
w
-5-
num=5
n=l
While n < 5 do
num =num + n
n=n+2
PRINTnum
End While
(A) 5 8
(B) 5 9
(C) 6 8
(D) 6 9
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?
(A) I only
(B) II only
(C) I and III only
(D) II and III only
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) *
**
***
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) 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
(A) X: arr[0] = i
Y: arr[vote] = arr[ vote - 1] + l
Z: Print (arr [i])
(A) 5
(B) 8
(C) 24
(D) 120
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.
END OFTEST
02 I l SO I 0/MJ/CAPE 2020