Computer Science Paper 2
Computer Science Paper 2
Computer Science Paper 2
COMPUTER SCIENCE
PAPER 2 Practical
Additioml materials:
CD foreach candidate
kintrng facility
Bond
TIME 3 hours
INSTRUCTIONS TO CAITDIDATES I
This is a purely practical examination. All answers should be priated. Handwritten atrswersi
will not be marked.
This paper consists of three sections.
Sectioa A 20 marks
Section B 50 marks
""
at,
Section C 30 marks
Answer one question from each section.
Each answer sheet should include the fdflowing information in &e header sectior:
. Candidate Name and CandidatelNumber
. Centre Name and Datei
. Subject Code
when answering prograaming questiops, indicate the ranguage used.
All work should be backed up by a sofl copy on a CD.
If you print on more t\an one sheeg fasten the sheets together.
All answers should be correctly and clearly numbered.
I
The number of marks is git'en in bracklts [ ] at the end of each question or part question.
tx (a) Three digital setrsors A, B and C are used to monitor a process. The outputs from
the sensors are used as the inputs to a logic circuit.
A
Logic Circuit OutputX
B
C
Time interval
State 1 2 J 4 5 6 7 I
Fetch instruction L
L
Execute instruction
6023i2N2022
3
2 (a) Consider the logic statemert below.
(ii) Construct a truth table to explain how the logic expression works
t5l
(b) Illustrate with an aid of a diagram the steps of the fetch-execute cycle.
t8l
6023i2N2022
[Turn over
4
J (a) Produce a program code that rolls a dice 20 times and counts the number
oftimes that 4 appears- The code should then print the number of times
that4 appears. t8l
(b) Produce a program that contains a calling statement to call a function
that calculates the sum of 2 numbers and store the answer in the
variable sum. Also defiae the function. tsl
(c) Bandile is working on developing an algorithm using a high level
language to implemeat a substitution cipher. His plan is to:
(d) A school has a program for managing its prefect body. The program has
beea written in an object-oriented programming language.
6023t2N2O22
Prefect
Prefect Name
Male
Date Appointed
' ( Constructor
' Set Prefect Name
'. Set Male
Set DateAppointed
. Get Expiry Date
6023/2N2A2Z
[Turn over
&
Student csv
Student table
Name, surname, D" O.B, Reg number, male
0t/08/2004 01 No
A 70 to 100
B 60 to 69
C 50 to 59
D 44l'o49
E 30 t0 39
TT
A to29
(d) [11]
x". n I 1
I L J 4
y:0 0 * * 0 0
I C 0 0 0 0
'I
2 G 0 L 0 0
I I
CI t 1
I 0
4 1 I I 1 I
6423/2N2022
7
---->
6023/2N2022
8
Study the Lupane University Athletics table below and auswer the questions that follow
(a) Produce the SQL code that defines a primary key of this table. L21
(b) Produce the SQL code that can be used to produce the Athletics table
above. t8l
(c) Produce the SQL command w'hich can be used to add the record below.
(d) The sports director for Lupane State University wants to see thb Reg.
Number and the sport fields only for the students.
Produce the SQL code to display Reg. Number and sport- L2l
(e) Athlete MC 0708 has moved to another university. Her details need to
be removed &om the table.
Using a drawing tool of your choice, draw and clearly label the ERD for
&e standard notation given above. teI
6823i?N2022
9
{ A hospital is divided into two areas, Area A and Area B. Each area has
several wards. All the ward aames are different. A number of nurses
are
based in Area A. These nurses always work io the same ward. Each
nurse has a
unique Nurse ID of STRING data type.
A-NURSE A-VTARD
B-NURSE B-$/ARD
6A?3/2N2022
F6
-
B-Ward-Nurse(........... .)
(iii) Draw tle relationships of the three tables above usiag an ERD. t3l
(ii) Tendero, who is an Area B nurse with the nurselD 076 has recently
manied andher new family trame is Makwanzini. Produce an SQL
command to update her record. t5]
(e) A student intends to create a database with tables whose records can be
accessed using a form based iaterface created using a high level
programming language. The standard normal form of the member table in
the database is as follows:
(i) design a data structure (file design) of the member file in tabular
form (using aword processor) with the following column headings
4023/2N2022