Professional Documents
Culture Documents
‘‘*’’Barcode Area”*”
Front Page Bar Code
13 MAY 2021 (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 2021203 MAY/JUNE 2021
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
1. (a) The functionality of simple logic gates can be combined to implement more complex
operations.
(i) Draw the symbols for EACH of the THREE basic logic gates.
[3 marks]
(ii) Draw the associated truth tables for EACH of the THREE basic logic gates.
[3 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(iii) Draw the truth table that shows the output from a circuit that performs the function
NOT (X AND Y).
[2 marks]
(iv) Write the logic expression for a circuit that can provide the following truth table.
X Y Output
0 0 0
0 1 1
1 0 1
1 1 0
....................................................................................................................................
....................................................................................................................................
[3 marks]
(b) State the range of integers with 8-bits, using sign magnitude representation.
.............................................................................................................................................
..............................................................................................................................................
[2 marks]
(c) The binary sequence 01111110 equates to the decimal value 126, using two’s complement.
(i) Show the steps involved in determining that the 8-bit two’s complement
representation of the value –126 in the binary sequence is 10000010.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[2 marks]
(ii) Explain what happens when a computer that uses 8-bits two’s complement integers
attempts to evaluate the expression (−126 −3). Show ALL working.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[5 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(d) Write the decimal value that is represented by the sequence 10110101, if it stores a floating
point number with a 1-bit sign, a 4-bit mantissa and a 3-bit exponent. In the specified
floating point format, the smallest value in the mantissa is 0 and the binary point is situated
immediately to the left of the mantissa. Show ALL working.
.............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
.............................................................................................................................................
..............................................................................................................................................
[5 marks]
Total 25 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
2. (a) (i) Flip-flops and registers are commonly used in computer systems. State the meaning
of the term ‘flip-flop’.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[1 mark]
(ii) Draw a labelled diagram that depicts how a set of flip-flops can be used to create
a 4-bit register.
[5 marks]
(b) State the name of the smallest addressable unit of memory in RAM, in modern computer
systems.
..............................................................................................................................................
..............................................................................................................................................
[1 mark]
(c) Write the name of the circuit MOST commonly used to achieve the following objectives:
....................................................................................................................................
....................................................................................................................................
[1 mark]
....................................................................................................................................
....................................................................................................................................
[1 mark]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(d) (i) State the purpose of virtual memory in a computer system.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[1 mark]
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[3 marks]
(iii) Describe the interaction between components in a computer system that allows a
virtual memory address to be accessed.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[3 marks]
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[3 marks]
(ii) Describe the role played by EACH of the components stated in (e) (i) during the
instruction cycle.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[6 marks]
Total 25 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
SECTION B
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[2 marks]
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[6 marks]
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[3 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(c) (i) State TWO ways, other than the use of flowcharts, in which algorithms can be
represented.
....................................................................................................................................
....................................................................................................................................
[2 marks]
(ii) The algorithm below is designed to determine the average weight (in kg) of a set
of potatoes. A negative weight is entered to signify the end of input.
In the space provided on page 17, draw a flowchart to represent the process flow
in the algorithm.
[12 marks]
Total 25 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
4. (a) List THREE properties of well-designed algorithms.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[3 marks]
(b) Describe the THREE control structures which can be used in structured programming.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[6 marks]
(c) The organizer of the Carifta Games would like a program to manage the daily calculations
of the bills of customers for the 2021 games.
It should also accumulate the total number of tickets (“totNumOfTickets”) sold for the
day and the total revenue made on any particular day.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[2 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(ii) Display (print to screen) the menu of the stand options (including base cost and
discount) given, with an (E)Exit option, and to get the choice (The character
associated with one of the menu options - stand type or (E)Exit from the keyboard.)
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[5 marks]
(iii) Read in EACH variable value for the custNum and numOfTickets from the
keyboard.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[2 marks]
(iv) Calculate the bill for EACH transaction and then update the revenue and
totNumOfTickets. Then, display (output) the customer number and bill in one
statement.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
[7 marks]
Total 25 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
SECTION C
PROGRAMMING
5. (a) Describe how the linking process relates to source, object and machine code.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[3 marks]
(b) The C function printPowers, listed below, is expected to print some values.
void printPowers()
{
int i = 1,j, pow2=1, base = 2;
While (i < 4)
{
For (j = i; j<= i; j++)
{
pow2 = pow2 * base;
printf(“2 raised to the power of %d is %d\n”, i, pow2);
}
i++;
}
}
(i) Write the outputs expected when the function printPowers is executed.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[6 marks]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(ii) Write a function with the header int power(int base, int expt) that accepts integer
arguments base and expt and returns an integer equal to base raised to the power
of expt. The body of the function power may only use basic operations like
multiplication or addition.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[6 marks]
.................................................................................................................................
.................................................................................................................................
[1 mark]
.................................................................................................................................
.................................................................................................................................
[1 mark]
(v) Write an adjusted version of the function printPowers that calls function power
and achieves the objective of displaying 3 raised to the power of each EVEN
number between 1 and 6.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[8 marks]
Total 25 marks
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
6. (a) Using ONE example for EACH, briefly describe any TWO programming paradigms.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[6 marks]
(b) State TWO reasons why using modular code is considered good programming style.
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
..............................................................................................................................................
[2 marks]
(c) The following C code reads some integer values and then prints the sum of integer values
that have been entered. Note, however, that there are two syntax errors in the presented
code.
void main(){
int numList [10];
int newNum=0,ndx =0, sum=0;
while (newNum ≥0)
{
scanf(“%d”,newNum);
if (newNum > 0)
{
numList[ndx] = newNum;
sum += newNum;
ndx++;
}
}
printf(“%d”,sum);
}
(i) Describe the expected syntax error in EACH erroneous line of code and write the
corrected version of the erroneous lines.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[4 marks]
(ii) State ONE possible semantic error that can occur during execution when the
syntactically correct version of the program is operating. Assume that the user will
only enter valid integers and that integers in C are represented using four bytes.
.................................................................................................................................
.................................................................................................................................
[1 mark]
DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA
(iii) Write a program that uses C code to read a set of integers and then outputs the most
frequently submitted integer and the sum of the integers. Your program should
keep track of frequencies using an array declared using int numFreq [10]. Error
handling to prevent errors during execution should be included in your program.
Assume that the contents of an integer array are initialized to 0 on declaration.
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
.................................................................................................................................
[12 mark]
Total 25 marks
END OF TEST
IF YOU FINISH BEFORE TIME IS CALLED, CHECK YOUR WORK ON THIS TEST.
02115020/MJ/CAPE 2021
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 29 -
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 2021
‘‘*’’Barcode Area”*”
Sequential Bar Code
- 30 -
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 2021
‘‘*’’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: _________________________________