2023 Cape CS Unit 1 P2 Clean
2023 Cape CS Unit 1 P2 Clean
‘‘*’’Barcode Area”*”
Front Page Bar Code
06 JUNE 2023 (a.m.)
TEST CODE 0 2 1 1 5 0 2 0
PROFICIENCY ADVANCED
REGISTRATION NUMBER
SCHOOL/CENTRE NUMBER
NAME OF SCHOOL/CENTRE
DATE OF BIRTH D D M M Y Y Y Y
Current Bar Code
SIGNATURE __________________________________________________
‘‘*’’Barcode Area”*”
Sequential Bar Code
DO
NO
W T
RI
TE
TH ON
IS
PA
GE
TEST CODE 02115020
FORM TP 2023203 MAY/JUNE 2023
COMPUTER SCIENCE
UNIT 1 – Paper 02
2 hours 30 minutes
4. If you need to rewrite any answer and there is not enough space to do so on the
original page, you must use the extra lined page(s) provided at the back of this
booklet. Remember to draw a line through your original answer.
5. If you use the extra page(s), you MUST write the question number clearly in
the box provided at the top of the extra page(s) and, where relevant, include
the question part beside the answer.
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
SECTION A
COMPUTER ARCHITECTURE
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
(b) A gamer wishes to purchase a new computer. State THREE hardware specifications that
should be considered and explain why EACH specification was chosen.
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[6 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(c) Briefly describe the processes in the fetch-decode-execute instruction cycle.
.............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
[3 marks]
Total 15 marks
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[2 marks]
(b) Construct the truth table for the circuit shown in Figure 1 by listing all possible input bit
patterns and their corresponding outputs. Show all intermediate steps.
[6 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(c) Calculate the binary floating point representation of the decimal number 5.50, using 1-bit
sign, 3-bit exponent and 5-bit mantissa. Show all working.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[4 marks]
(d) Find the 8-bit two’s complement of -11. Show all working.
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[3 marks]
Total 15 marks
SECTION B
3. (a) State how the top-down problem-solving method differs from the bottom-up method.
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[2 marks]
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(iv) ‘Implementation and review’
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[4 marks]
(c) A food court with three restaurants serving Jamaican, Barbadian and Trinidadian cuisine
has a single cashier. A separate bill is needed for each restaurant. Each meal is priced as
shown in the table.
There is also sales tax of 10% and a discount of 5% if a customer buys more than one meal.
Write the appropriate pseudocode for calculating a single bill for a single customer,
assuming that there are variables called ‘bill’, ‘menuOption’ and ‘numOfMeals’. There
should be an option to exit the pseudocode.
...............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[9 marks]
Total 15 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
4. (a) Examine Algorithm 1 and Algorithm 2 and answer the questions that follow.
Algorithm 1
READ A
SUM = 0
WHILE A <> 0 DO
SUM = SUM + A
READ A
END WHILE
Algorithm 2
FOR X = 1 TO 15 DO
PRINT X
END FOR
(i) State which of the algorithms above illustrates unbounded iteration. Justify your
answer.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[1 mark]
(b) Trace through the execution of the following algorithm and in the space provided, draw
the output exactly as it would be generated by the algorithm.
START
Declare i = 1, j as Integer
While (i < = 4)
If (i % 2 = = 0) Then
Begin
Print "$"
For j = 1 to 4
Print "*"
EndFor
Else
Begin
For j = 1 to 4
Print "*"
EndFor
End IF
Print newline
i=i+1
EndWhile
STOP
[6 marks]
GO ON TO THE NEXT PAGE
02115020/MJ/CAPE 2023
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 14 -
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(c) The following algorithm is designed to print a table of cubes of all the even positive integers
between 4 (inclusive) and 14 (inclusive). However, there are errors in the algorithm.
1. i=4
2. while i < 14
3. i * i * i = cube
4 print i, cube
5. i=i+1
6. end while
By referring to the specific line numbers, identify and correct the THREE errors so that
the algorithm achieves its objective.
Line Number Error Correction
[6 marks]
Total 15 marks
SECTION C
PROGRAMMING
5. (a) (i) State TWO differences between ‘a compiler’ and ‘an interpreter’.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[4 marks]
(ii) Explain how the assembly and linking processes allow code written in high level
programming languages to run on a wide range of machines.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[3 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(b) (i) Write a C declaration for a structure that holds the record of a customer. Each
record contains a customer ID (integer) and a customer balance (float).
Note that balance represents the amount of money a customer has for making
purchases.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[3 marks]
(ii) Declare a variable to represent ONE customer, Andrew, and set his record values
as shown in the information below.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[3 marks]
Write C code to read the value from the keyboard that represents Andrew’s purchases
and calculates his customer balance based on the purchase.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
Total 15 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
6. (a) Describe what is meant by the term ‘semantic errors’.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[2 marks]
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[1 mark]
(c) Write a C function, arraySum, which accepts an integer array and an integer variable,
clearly indicating the size of the array as parameters. The function should return the sum
of all the numbers in the array that are NOT greater than 50.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[7 marks]
(d) Complete the trace table below by writing the output values of i, n and result at the
beginning of each iteration, if the function fact(5) is invoked by the following C function
fact(n), defined as
i n result
[5 marks]
Total 15 marks
END OF TEST
IF YOU FINISH BEFORE TIME IS CALLED, CHECK YOUR WORK ON THIS TEST.
02115020/MJ/CAPE 2023
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 20 -
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
EXTRA SPACE
If you use this extra page, you MUST write the question number clearly in the box provided.
Question No.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
02115020/MJ/CAPE 2023
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 21 -
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
EXTRA SPACE
If you use this extra page, you MUST write the question number clearly in the box provided.
Question No.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
02115020/MJ/CAPE 2023
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 22 -
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
EXTRA SPACE
If you use this extra page, you MUST write the question number clearly in the box provided.
Question No.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
02115020/MJ/CAPE 2023
‘‘*’’Barcode Area”*”
Sequential Bar Code
DO
NO
W T
RI
TE
TH ON
IS
PA
GE
CANDIDATE’S RECEIPT
INSTRUCTIONS TO CANDIDATE
TEST CODE 0 2 1 1 5 0 2 0
PROFICIENCY ADVANCED
REGISTRATION NUMBER
SIGNATURE ________________________________________________________________
DATE ______________________________________________________________________
2. Ensure that this slip is detached by the Supervisor or Invigilator and given to you when you
hand in this booklet.
INSTRUCTION TO SUPERVISOR/INVIGILATOR
Sign the declaration below, detach this slip and hand it to the candidate as his/her receipt for this booklet
collected by you.
I hereby acknowledge receipt of the candidate’s booklet for the examination stated above.
Signature _____________________________
Supervisor/Invigilator
Date _________________________________