100% found this document useful (1 vote)
449 views53 pages

2022 Bluebook Computer Science

The document is an examination paper for the Zimbabwe School Examinations Council's General Certificate of Education Advanced Level in Computer Science, dated November 2022. It contains various questions covering topics such as binary arithmetic, IP addresses, protocols, interrupts, and e-waste management. Candidates are instructed to answer all questions within a 3-hour timeframe, using the provided answer sheets.

Uploaded by

chidziwosteven
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
449 views53 pages

2022 Bluebook Computer Science

The document is an examination paper for the Zimbabwe School Examinations Council's General Certificate of Education Advanced Level in Computer Science, dated November 2022. It contains various questions covering topics such as binary arithmetic, IP addresses, protocols, interrupts, and e-waste management. Candidates are instructed to answer all questions within a 3-hour timeframe, using the provided answer sheets.

Uploaded by

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

Fd |'zttmnft Medsfi(mfi

ZIMBABWE SCHOOL EXAMINATIOI{S COUNCIL


General Certificate of Education Advanced Level

COMPUTER SCIENCE 6023tL


PAPER 1

]{OVEMBER 2CI22 SESSION 3 lrours

Additional materials:
Answcr papcr

I'IN'IE 3 hours

INSTRUCTTONS TO CANDIDATES

Write your name, centre number and candidate number in the spaces provided on the answer
paper/answer booklet.

Answer all questions.

Write your answers on the separate answer paper provided.

If you use more than one sheet of paper, fasten the sheets together,

INFORMATION FOR CANDIDATES

The number of marks is given in brackets [ ] at the end of each question or part question,

You are reminded of the ne ed for good English and clear presentation in your answers.

This question paper consists of 5 printed pages and 3 blank pages.

Copyright: Zimbabwe School Exarninations Council, N2022.


OZiMSEC N2022 [Turn over]
2

1 (a) (i) State any one difference and any one siinilarity bet,"veen ASCII
and Unicode. 121

tii) State the number of bits used by an EBCDIC character. t1l

(b) Perform the following binary arithmetic operations in 8 trit systems.


Show your workings clearly.

(i) 01001001 +00101111 l2l


(ii) 01101001 + 00000101 t2l

(c) In the same 8 brt system, a student attempts to perfbrm the


following arithmetic operation

01100100 x 00000011

(l) Perform the operation giving the result in 8 bits. t3l

(ii) State the type of error that is jn this result. I1l

(d) A digital system uses 16 bits for its Normalised floating point
representation.

rEantis$a exponent

Copy and complete the binary pattern for the:

(D the srnallest positive value, l2l


(ii) highest magnitude negative value. t21

2 (a) Define the terrn lP address. t21

(b) Explain the purpose of an IP address. t2l


(c) Distinguish between public and private IP addresses. t4l

{d} Describe the two components that make up the lP address. t4l

3 (0) Deflrne the term protocol. I2l


(b) Describe the SMTP. t4l

(c) State any two functions of the data link layer. t2l

6023/l N2022
3

4 (a) Explain any two types of intelrupts and give an example of how
each may be generated.
l6l
(b) Pt* a diagrarn representing a Von Neumann Architecture and explain
how it differs from the Harvard Architecture.
t6l
5 A power station has a safety system trased on 3 inputs to a logic network. A
warning signal (S = 1) is produced when cefiain conditions occur based
on these
3 inputs.

Jnput Binary value Plant statlls


T 1 lure >l20 oC
0 Tem 120.c
P I Pressure > 10 bar
0 Pressure < 10 bar
w 1 water > 1001ihr
0 Cooling water < 100 l/hr

A warning signal (S: D will be generated if


either (a) Temperature > 120 oc and cooling water < 1001/hr
or (b) Temperature < 120 nC and (Pressure > I 0 bar or cooling water < 100 l/hr)
Draw a logic network and truth table to show all the possible situations
when
the warning signal could be received
lg]
6 Manga Electronics is a start up cornpany which intends to expand
into e-waste
management industry.

(a) Define the term e-wa,yte. el


(b) Discuss the social aad economic impact of e-waste business to the
irnmediate community
i5l
(c) (i) Define rhe term dara privacy. Ltl
(ii) state any two business ethics the company shourd foilow. l2j
7 Names are stored in a binary tree according to the algorithm below.

Repeat
If Narne > Node Then
take right pointer
Else
Take left poinrer
End If
Until empty Node
Tnsert Narne

6023/1N21r22

ITurn over
4

(a) Given that the root node is Dumisani, create a binary tree resulting from
inserting the following in the order given:

Chelesani Ratidzai Arrrr-rleka 'l.endai


Gamuchirai. [3]

{b} Describe an algorithm tbr using the tree to read the names in alphabetic
order l2l
8 (a) write an algorithm, in pseudocode, of a program that accepts any 200
positive numbers and displays their sum.
lsl
(ti study the flor,vchart belor.v and ansrver the questions that follow.

Start

Read N

SetMto I
SetF to I

Add 1 to the cun"ent


value of kI

New Value of F: currenl


value of F multiplied by M

YES

Frint F

6023/1 N2t>22
5

(0 Dry run the algorithm given that the value of N is 5

Use the trace tahle template below"

N M F M: N? 0utput

t4l

(ii) outline the function or task that is performed by the tlow chart
above t1l

9 (a) Explain why database design is important' l4l

(b)

Entity Relation Mode1

Attribute Relationship
Entity

Diagram'
The diagram above shows componerts of an Entrty Relationship

Describe the three components, giving examples' t6l

10. {*) Define thetetm Patent. lil


Justily why patents are nocessary in systems development' t3l
tb)

Explain how the use of e-cof,nmerce cou'ld be beneficial for


a
(c) t4l
small company. LIJ

(d) Explain any two ICT global changcs in c-lcarning' t4l

602311 N2022
6

BLA}IK PAGE

6023/1 N2022
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

Computer Science:N22

For Queries: 0716057680

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
[email protected] [email protected]
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

 ASCII (American standard Code for information Interchange) is used to


represent text in form of symbols,numbers,and character, whereas UNICODE
is used to exchange process, and store text data in any
language format

 EBDIC uses 8 bits/byte

o 01001001 =73
+00101111= 47
----- ------------------
01111000= 120
_______________

(ii) 01101001 / 00000101

01101001=100
--------------- Use Normal Division method Aside
00000101=5

100/5=20

20=00010100

 01100100 =100 Same Concept, multiply DEC aside


x 00000011=3

100*3=300
300= 100101100

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

 Overflow of data due to the increased number of bits from the initial range

(1) 0.0000001 00000000


(2) 1.1111111 11111111

 An IP address is a number that uniquely identifies every host on an IP


network. IP addresses operate at the Network layer of the TCP/IP protocol
stack, so they are independent of lower-level Data Link layer MAC addresses,
such as Ethernet MAC address

 It ensures that data is transmitted to its correct address (IP address). Every
device on the internet has its IP address

 A public IP address is a unique IP address assigned to your network router by


your internet service provider(ISP)and can be accessed directly over the
internet. A private IP address is a unique address that your network router
assigns to your device. It is used with a private network to connect privately
to other devices

 The network ID (or network address) identifies the network on which a host
computer can be found.
 The host ID (or host address) identifies a specific device on the network
indicated by the network ID

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

 A protocol is a set of rules that govern how data is transferred in a network. It


defines the rules on how network devices communicate, e.g the TCP/IP.

 SMTP stands for “Simple Mail Transfer Protocol”. It is a technical standard for
transmitting electronic mail (email) over a network.
 SMTP defines a process for exchanging data between an email client and a
mail server.
 An email client is what a user interacts with: the computer or web
application where they access and send emails.
 A mail server is a specialized computer for sending, receiving, and forwarding
emails; users do not interact directly with mail servers

 Data Link Layer - provides error-checking and formats data for physical
transmission, type of network and packet sequencing is defined, used for
syncronisation

 Input / output interrupt: they are generated by the I/O devices when transfer
is complete or when there is an error in transmission, e.g. disk full, printer
out of paper, etc.

 Interrupts generated by running process: process may need more storage or


to communicate with the operator

 Timer interrupts: generated by the processor clock, e.g. control being


transferred to another user in a time sharing system, or the processor want
to perform a routine task which is done at that exact time daily.

 Program check interrupts: caused by errors in a program, e.g division by zero

 Machine check interrupts: Caused by malfunctioning hardware. Clock


(happens normally in time sharing systems where the clock transfers control
from one computer to another.)

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

 The von Neumann architecture allows instructions and data to be mixed and
stored in the same memory module and the contents of this memory are
addressable by location only. The execution occurs in a sequential fashion.
 Von Neumann architectures usually have a single unified cache

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

S=1 IF (T=1 AND W=NOT1) OR T=NOT1 AND(P=1 OR W=NOT1))

Truth table

t p w t' w' t.w' p+w' t'.G F+H=X


0 0 0 1 1 0 1 1 1
0 0 1 1 0 0 0 0 0
0 1 0 1 1 0 1 1 1
0 1 1 1 0 0 1 1 1
1 0 0 0 1 1 1 0 1
1 0 1 0 0 0 0 0 0
1 1 0 0 1 1 1 0 1
1 1 1 0 0 0 1 0 0

6(a) E–waste is the discarded or unwanted electronic devices, such as computers and
mobile phones ,which are no longer required or useful to the owner and may pose
health risks to the environment is not disposed properly

(b)
 The e-waste business can provide employment opportunities for
individuals within the community
 It can serve as a source of income and contribute to the economy of
the immediate community
 The e-waste business can promote environmental protection by
reducing the amount of electronic waste that ends up in landfills and
pollutes the environment
 E-waste recycling can help safeguard public health by preventing the
release of toxic or harzadous substances into the environment
 It can lead to technological advancements and contribute to the
development of the community by facilitating the acquisition of new
skills and knowledge

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

(i) Data privacy refers to the protection of personal information from


unauthorized access,use or disclosure
(ii)

 environmental responsibility :The company should prioritize the environment


by adopting sustainable e-waste management practices that reduce harmful
impacts on the ecosystem
 transparency and honesty :the company should be open ,honest , and
transparent in all its e-waste management activities, including the handling
and disposal of electronic waste
 it should also communicate clearly with its stakeholders on its intentions and
actions towards environmental responsibility and e-waste management

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

Dumisani
8(a)

Chelesani Ratidzai

Tendai
Amuleka Gamuchirai

(b)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Sum=0
Repeat 200 times:
Input positive number
If input is positive then
Add input to sum
End If
End Repeat
Display sum

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

N M F M=N? Output
5 1 1 No
2 2 No
3 6 No
4 24 No
5 120 Yes 120

(ii)Calculate the factorial of a given number or alternatives

9(a)
 Efficiency: a well designed database can function at faster speeds
 Data Integrity: A well designed database ensures that the database
stores correct, accurate data, consistent and reliable data
 Security: A well designed database can protect sensitive data
from unauthorized access control mechanisms and security protocols
 Scalability : The design should be able to scale up and down as the
design of the database shrinks or grows
 Cost: A well designed database can reduce costs associated
with data management , such as storage and backup costs

(b)

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

 Entity- is an object or concept that is represented by data and stored in a


database . examples are in company database, entities could include
employees, departments and products
 Attributes: Each entity has an attribute that describes the characteristics of
the entity .For example , an employee entity might have attributes such as
name, address and salary
 Relationship: entities in a database can have relationships with each other .A
relationship is an association between one or more entities. For example in a
company database, an employee entity might have a relationship with a
department entity indicating that between the two exists a one-to-one
relationship

(a) A patent is a legal document granted to an inventor or assignee that gives


exclusive rights to the invention usually for a period of 20yrs from the date of
filling the patentapplication in return for disclosure of the invention to the
public.
(b) Patents are necessary for

 Protection of intellectual property


 Encourages innovation
 Supports investment
 Enables licensing and revenue generation

(c)
 Increased market reach: it allows small companies to reach beyond their
geographic location , which can help increase their customer base and
increase sales
 Lower overhead costs:it reduces the need for physical storefronts and sales
personell , which can help reduce overhead costs associated with traditional
retail operations
 Increased customer convenience:it provides access to valuable customer
data, including purchasing history and browsing behavior
 Increases competition:allows small companies to compete with larger ones

(d)

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel free to contact if you have any objections with this documentation ---------
CYBRWAV3 GODS OWN PROVRBS 16:3 NOVMB3R 2022 SUGGESTED MS 0716057680

o The Growth of Artificial Intelligence (AI): AI is revolutionizing the way


we interact with technology. Advances in AI are making it possible to
create intelligent systems that can reason, learn, and adapt to new
situations. AI is being used to automate routine tasks, such as
customer service and data entry, and to develop more sophisticated
applications, such as au
autonomous vehicles and drones.

o The Internet of Things (IoT): The IoT is a network of interconnected


devices, sensors, and machines that can communicate with each
other and the internet. The IoT is transforming industries such as
healthcare, transportation, and manufacturing, by enabling the
collection and analysis of vast amounts of data in real
real-time.
time. The IoT is
also creating new opportunities for innovation, such as smart homes
and cities, and connected vehicles.

 In summary, two global changes in the ICT industry include the growth of AI,
which is transforming the way we interact with technology, and the Internet
of Things, which is creating new opportunities for innovation and
transforming industries.

Follow my youtube channel for tutorials

https://youtu.be/pxRClxgQ_3s

PROVRBS 16:3 Commit thy works unto the lord and thy thoughts shall be established

------------Feel
Feel free to contact if you have any obj
objections
ctions with this documentation ---------
ZIMBABWE SCHOOL EXAMINATIONS COUNCIL
General Certilicate of Education Advanced Level

COMPUTER SCIENCE
PAPER 2 Practical

NOVEMBER 2022 SESSION 3 hours

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

II\IFORMATION FOR CANDIDATbS


\ I

The number of marks is git'en in bracklts [ ] at the end of each question or part question.

This question peper of l0 printed pages and 2 blank pages.


Copyright: Zimbabwe School Ex"minations Council, N2AZ2
OZIMSECN2O22
[Turn over
Section A [20 marksl

Aaswer any one question from this section.

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 signal X, is output from the logic circuit.

A
Logic Circuit OutputX
B
C

(, Formulate a logic expression for &e conditions below,

Output X, has a value of I if ei&er of the following conditions ocnr:

sersor A outputs the value 1 or sensor B ouryuts the value O


sensor B outputs the value 1 and seasor C outputs the value
o. t3l
(ii) Draw a logic circuit to represent the logic expression in (i) tsl
(iir) Construct the truth table for the logic circuit above. t4l
(b) The table below shows the five stages that occur when instructions are
fetched and executed. Two instructions, D followed by E, are fetched
and executed. The "E" ifl the incomplete table shows &at instruction
E has been fetched in time interval 2.

Time interval
State 1 2 J 4 5 6 7 I
Fetch instruction L
L

Read registers and decode instructioa

Execute instruction

Access operating memory

Write result to register

Copy and complete of the table t8l

6023i2N2022
3
2 (a) Consider the logic statemert below.

X: 1 if (A AND B) OR (B OR C) AND (B AND C)

(t) Draw a logic circuit to represent the above expression.


171

(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

Section B [50 marksl

Answer an); one question from this section

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:

set up a random set ofletters and store them in an array of


26 characters
then in order to implement the cipher the program then substitutes
each letter with the correspondiag position in an array
he has decided the letter 'A' to be at position l, letter 'B' ....
UnalZ:position 26.

{D Produce program code that declares a global urcy of 26 characters.[2]

(ii) Produce code that implements a procedure which has a string


arguments of the relevant scope. The purpose of which is to
perform strhg substitution, for example

encryp{<plaia text>) t8I

(d) A school has a program for managing its prefect body. The program has
beea written in an object-oriented programming language.

A perfect class has been designed.


It has 2 subclasses.
- sports prefect
- clubsprefect

The followiag is an inheritance diagram for the classes

6023t2N2O22
Prefect

Prefect Name
Male
Date Appointed

' ( Constructor
' Set Prefect Name
'. Set Male
Set DateAppointed
. Get Expiry Date

Sportsprefect Ciubs Prefect


sportsgroup Club Type

Set Sports Group Set Club Type

Get Sports Group Get Club Type

Produce a program code to implement the structure above-

N.B. Function/method header only required. The code detail inside


each functiorlmethod is not required. F0I
(e) A program is to be designed to collect data from learners:

each t'.ne it runs, it collects data from forcr 1 learners


the data are appeuded to a csv fi.le
the csv file has the following header

6023/2N2A2Z

[Turn over
&

Student csv

Student table
Name, surname, D" O.B, Reg number, male

Samuel, Pasipanody a, 23 lA3 D003, 00259 l, yes

0t/08/2004 01 No

(l) Produce a program that appends data for each learner


file- onto the csv
Irol
, (ii) Produce a program that reads &e fire created in (i)
aad then
writes another file using all capital letters. t71
Jabatshaba Repairs offers repair services at atateof $20 per hour for labour. cost of supplies
are subject to 159/0 sales ta:r-

(a) Usiag the chosen HLL, design an interface which presents


the bill for the
situation, the customer's rame, labow hours and
tie cost of supplies.
output is customer's name, labour cost, supplier,s cost
*d todi"; t5]
(b) using &e situation given in {a} produce a code t}at wilr
carcurate the
total cosl labour-cost, supprier'i cost and display
labour cost, supplie.,, and ,*i
the customer name,
total. 'ssrw2
tl0l
(c) Produce code wlich wil classiS any mark captured
according to the
grades below. Use the IF statement.

A 70 to 100
B 60 to 69
C 50 to 59
D 44l'o49
E 30 t0 39
TT
A to29

The grades should be displayed.

(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

The grid represents tables in a restaurant. The zeros (0)


represent kble
not yet occupied, the ones (1) tables occupied.
using th. ,oo."pt of 2 D
anays, produce code to represefi the diagram
Lt2l
{e)

---->

Tower Torver Tower Tower Tower


n Tower
A i> C *
A C

The concept is referred to as the tower of Hanoi.


The disks are of
different size and are stacked in ascending order of
siz*,t*!.rt at &e
bottom aad smallest at the top. stack the dista from
toweiX ,o*", c u,
t!o*l in diagram- only one disk may be moved at a time. Norodisk may be
placed on top of a smaller disk at any time (even
in the p.o""r. of stacking.)

Design an algorithm to solve the problem.


L7)
(0 Produce code that read all the cortents of a
text file and outputs the
aumber of lines in the text file.
lsl

6023/2N2022
8

Section C [30 marksl

Answer aily one questior from this section.

Study the Lupane University Athletics table below and auswer the questions that follow

Reg. No. Last name Age Course Sport

MC1804 Sean Gutsa 18 IT Soccer

MCO808 Bongiwe Shumba 18 Maths Cricket

MC0708 Sisa Bako 2A Maths Chess

MC0309 Vimbai Dube l9 Electronics Soccer

MC0909 Dumisani Nkomo t7 Economics Cricket

(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.

MC 9414, Kuda, MoYo, 19, ICT, Cricket 171

(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.

Produce the appropriate SQL command to rernove her from &e


Athletics table. t2l

(f) Study the standardnotation for a library system below

Borrower Gonower-lD Name, Address)


Book (&cessionNumUgl Title, Author, Date Published)
Loan (&ggssionNumbgf, BorrowerlD, DateDue)

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

{a) Describe the relationship shown on the diagram above.


i1l
(b) A relational database is created to store the ward aad nurse data. The two
table designs for Area A are:

A - Ward (WardName, NumberofBeds)

A - Nurse (Surname, FirstName, . _ ..., . ...)

(, Complete the design for the table A-Nurse.


t2]
(i, Explain how the relationship in part (a) is impremented.
12l
(c) In Area B of the hospital, there are a number of wards and a number
of
nurses.

- Each Area B ward has a specialism


- Each Area B nurse has a specialism

A nurse can be asked to work in any of the Area B wards where


theii specialism matches with the ward specialism.

The relationship for Area B of the hospital is as shown below.

B-NURSE B-$/ARD

(, state the degree of relationship between the eatities B-Nurse


and B-ward.
I1I

6A?3/2N2022
F6
-

(ii) The design for Area B data is as follows:

B-Nurse (NurseID, Firstname, FamilyName, Specialism)

B-Nurse (V/ardName, NumberofBeds, Specialism)

B-Ward-Nurse(........... .)

Complete the attributes of B-ward-Nurse table. t3I

(iii) Draw tle relationships of the three tables above usiag an ERD. t3l

(d) Usiag the design for tables in part (cXiii).

(4 Produce a SQL l1uery to display the NurseID and family name


for all Area B nurses with a specialism of "Theatre". t3I

(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:

member(memberlD, FirstName, Sumame, DateJoined,


JoiningFee, CellNumber)

Usrng the inforrnation provided above,

(i) design a data structure (file design) of the member file in tabular
form (using aword processor) with the following column headings

FieldName, Size, Format/Validation, Data type 13l

(ii) design a form-based interface for the member table using a


high level programming language of your choice. Command
buttons are not necessary.

Produce a screenshot of the form and print it. 17|

4023/2N2022
1/1/2022

PAPER2 N22 COMPUTER SCIENCE 6032

Compiled By Cyberwave Gods Own

…………………………………………Proverbs 16:3

Suggested solutions #Revised n Reviewed | 0716057680


TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 2

SECTION A

[1] X=1 IF A=1 OR B=NOT1 OR B=1 AND C=NOT1

Paper2 |[email protected] also [email protected] Don’t forget to pray 2


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 3

A B C A+INVB INVB INVC B.INVC X


0 0 0 1 1 1 0 1
0 0 1 1 1 0 0 1
0 1 0 0 0 1 1 1
0 1 1 0 0 0 0 0
1 0 0 1 1 1 0 1
1 0 1 1 1 0 0 1
1 1 0 1 0 1 1 1
1 1 1 1 0 0 0 1

State 1 2 3 4 5 6 7 8
Fetch Instruction D E
Read registers and decode D E
instruction
Execute instruction D E
Access operating memory D E
Write result to register D E

Paper2 |[email protected] also [email protected] Don’t forget to pray 3


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 4

B X

Use MS Excell

D E F G X

A B C A.B B+C B.C E.F D+G


0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0
0 1 0 0 1 0 0 0
0 1 1 0 1 1 1 1
1 0 0 0 0 0 0 0
1 0 1 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 1 1 1

Paper2 |[email protected] also [email protected] Don’t forget to pray 4


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 5

(b)
Start
No

Any
instructions to
execute

Yes

Fetch next
instructions

Decode instruction Pass to interrupt


handling programs

Execute
Instruction

No Any Yes
interrupts to
be processed

Consider using Ms Word Tools

Paper2 |[email protected] also [email protected] Don’t forget to pray 5


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 6

SECTION B

Module Module1

Sub Main()
Dim rand As New Random
Dim face As Integer
Dim count As Integer
For i = 1 To 20
face = rand.Next(1, 7)
If face = 4 Then
count += 1
End If
Next
Console.WriteLine("4 appeared {0} times", count)
Console.ReadLine()
End Sub

End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 6


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 7

Module Module1
Private Function add(ByVal num1 As Integer, num2 As Integer) As Integer
Dim sum As Integer
sum = num1 + num2
Return sum
End Function

Sub Main()
Dim num1, num2 As Integer

Console.WriteLine("please enter num1")


num1 = Console.ReadLine()
Console.WriteLine("please enter num2")
num2 = Console.ReadLine
Console.WriteLine("{0} + {1} = {2}", num1, num2, add(num1, num2))
Take note how l called the add() function
Console.ReadLine()
End Sub

End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 7


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 8

C(i)

Module Module1
Public cyberwave() As Char = {"J"c, "K"c, "M"c, "Z"c, "N"c, "L"c, "Q"c, "R"c, "Y"c,
"V"c, "T"c, "T"c, "G"c, "W"c, "U"c, "D"c, "E"c, "C"c, "F"c, "B"c, "O"c, "A"c, "X"c, "S"c,
"I"c, "H"c, "P"c}

(ii) Public Function encrypt(plntxt As String) As String


Dim cyphertxt As String = ""
For Each c As Char In plntxt
If Char.IsLetter(c) Then
If Char.IsUpper(c) Then
cyphertxt += cyberwave(Asc(c) - Asc("A"c))
Else
cyphertxt += Char.ToLower(cyberwave(Asc(c) - Asc("a"c)))
End If
Else
cyphertxt += c
End If
Next
Return cyphertxt
End Function
Sub Main()
While True
Console.WriteLine("enter plain text")
Dim plntxt As String = Console.ReadLine()
Console.WriteLine(encrypt(plntxt))
Console.ReadLine()
End While
End Sub

End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 8


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 9

Paper2 |[email protected] also [email protected] Don’t forget to pray 9


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 10

(a)

Paper2 |[email protected] also [email protected] Don’t forget to pray 10


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 11

(b)

Public Class Form1

Private Sub GunaAdvenceButton1_Click(sender As Object, e As EventArgs) Handles


Calculate.Click
Dim labour As Double = Val(txthrs.Text) / 20
Dim supplier As Double = (Val(txtcost.Text) * 0.15) + Val(txtcost.Text)
Dim total As Double = labour + supplier

GunaDataGridView1.Rows.Add(txtname.Text, labour, Supplier, total)


End Sub
End Class

Paper2 |[email protected] also [email protected] Don’t forget to pray 11


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 12

(c) CASE-1 Using Console

Module Module1

Sub Main()
While True
Console.WriteLine("Enter your mark")
Dim mark As Integer = Console.ReadLine()
If mark >= 70 And mark <= 100 Then
Console.WriteLine("A")
ElseIf mark >= 60 And mark <= 69 Then
Console.WriteLine("B")
ElseIf mark >= 50 And mark <= 59 Then
Console.WriteLine("C")
ElseIf mark >= 40 And mark <= 49 Then
Console.WriteLine("D")
ElseIf mark >= 30 And mark <= 39 Then
Console.WriteLine("E")
ElseIf mark >= 0 And mark <= 29 Then
Console.WriteLine("U")
Else
Console.WriteLine("Invalid results")
End If
End While
End Sub
End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 12


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 13

Case2-GUI

Public Class Form1


Public Function grade(ByVal mark As Integer) As String
Dim result As String
If mark >= 70 And mark <= 100 Then
Result = ("A")
ElseIf mark >= 60 And mark <= 69 Then
result = ("B")
ElseIf mark >= 50 And mark <= 59 Then
result = ("C")
ElseIf mark >= 40 And mark <= 49 Then
result = ("D")
ElseIf mark >= 30 And mark <= 39 Then
result = ("E")
ElseIf mark >= 0 And mark <= 29 Then
result = ("U")
Else
result = ("Invalid results")
End If
Return result
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim mark As Integer = txtmark.Text
lblgrade.Text = grade(mark)

End Sub
End Class

Paper2 |[email protected] also [email protected] Don’t forget to pray 13


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 14

Module Module1

Sub Main()

Dim tables(,) As Integer = {

{0, 0, 0, 0, 0}, Simple 2D array

{0, 0, 0, 0, 0},

{0, 0, 1, 0, 0},

{0, 1, 1, 1, 0},

{1, 1, 1, 1, 1}

End Sub

End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 14


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 15

Module Module1
Sub main()
hanoi(1, 3, 2, 3)
End Sub
Sub hanoi(ByVal source As Integer, dest As Integer, temptower As Integer, ndisks As
Integer)
If ndisks > 1 Then
hanoi(source, temptower, dest, ndisks - 1)
End If
Console.WriteLine("Move Disk{0} from tower {1} to tower {2}", ndisks, source,
dest)
If ndisks > 1 Then
hanoi(temptower, dest, source, ndisks - 1)

End If
Console.ReadKey()
End Sub

End Module

Paper2 |[email protected] also [email protected] Don’t forget to pray 15


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 16

(f)

Sub CountLines()

Dim text As String

Dim lineCount As Integer

' Get the input text

text = InputBox("Enter some text:")

' Initialize the line count

lineCount = 0

' Loop through the text and count the lines

For Each line In text.Split("\n")

lineCount += 1

End For

' Display the number of lines

MsgBox("The number of lines in the text is: " & lineCount)

End Sub

Paper2 |[email protected] also [email protected] Don’t forget to pray 16


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 17

SECTION-C

(a) ALTER TABLE LupaneUniversityAthletics

ADD CONSTRAINT PK_LupaneUniversityAthletics PRIMARY KEY (RegNo);

(b)

CREATE TABLE LupaneUniversityAthletics (

RegNo VARCHAR(8) NOT NULL,

LastName VARCHAR(20) NOT NULL,

Age INT NOT NULL,

Course VARCHAR(20) NOT NULL,

Sport VARCHAR(20) NOT NULL

);

INSERT INTO LupaneUniversityAthletics (RegNo, LastName, Age, Course, Sport)

VALUES

('MC1804', 'Sean Gutsa', 18, 'IT', 'Soccer'),

('MCO808', 'Bongiwe Shumba', 18, 'Maths', 'Cricket'),

('MC0708', 'Sisa Bako', 20, 'Maths', 'Chess'),

Paper2 |[email protected] also [email protected] Don’t forget to pray 17


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 18

('MC0309', 'Vimbai Dube', 19, 'Electronics', 'Soccer'),

('MC0909', 'Dumisani Nkomo', 17, 'Economics', 'Cricket');

(d) INSERT INTO LupaneUniversityAthletics (RegNo, LastName, Age,


Course, Sport, CricketRuns) VALUES ('MC9414', 'Kuda', 'MoYo',
19, 'ICT', 'Cricket', 171);

(d) SELECT RegNo, Sport

FROM LupaneUniversityAthletics;

(e) DELETE FROM LupaneUniversityAthletics

WHERE RegNo = 'MC0708';

Paper2 |[email protected] also [email protected] Don’t forget to pray 18


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 19

Don’t worry about this construct

below

entity Borrower {

BorrowerID PK

Name
BorrowerID
Address Address Name

entity Book { Borrower

Accession Number PK

Title

Author
Accession Title
Number

DatePublished
Book
}
Date
entity Loan { Author
Published

Accession Number PK
Accession
BorrowerID FK BorrowerID
Number Loan
DateDue
Date Due
}

BorrowerID --> Loan

ISBN --> Loan

Paper2 |[email protected] also [email protected] Don’t forget to pray 19


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 20

6(a) Many-to-one

(b i)A-Nurse(Surname,Firstnmae,Ward_Number,NurseID)

(ii) The relationship between the A-Nurse and A-Ward tables is


implemented using a one-to-many relationship. This means that one
Nurse can be assigned to many Wards, but one Ward can only have one
Nurse assigned to it.

Paper2 |[email protected] also [email protected] Don’t forget to pray 20


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 21

C(i) Many-To-Many

1. WardNurseID (primary key): A unique identifier for each record in


the table.

2. WardID (foreign key): The WardID of the ward that the nurse is
assigned to.

3. NurseID (foreign key): The NurseID of the nurse who is assigned


to the ward

Nurse B-Ward Nurse Ward

Paper2 |[email protected] also [email protected] Don’t forget to pray 21


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 22

(i)

SELECT NurseID, FamilyName Note how l used the keyword where

FROM B-Nurse

WHERE Specialism = 'Theatre';

(ii)

UPDATE B-Nurse

SET FamilyName = 'Makwanzini'

WHERE NurseID = 076;

Paper2 |[email protected] also [email protected] Don’t forget to pray 22


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 23

Data
FieldName Size Format/Validation type

memberID 10 Alphanumeric Integer

FirstName 20 Alphabetic String

Surname 20 Alphabetic String

DateJoined 10 Date format Date

JoiningFee 10 Decimal format Decimal

CellNumber 15 Numeric format Integer

Paper2 |[email protected] also [email protected] Don’t forget to pray 23


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 24

Remember the question stated that command buttons are not necessary

Paper2 |[email protected] also [email protected] Don’t forget to pray 24


always
TRUST IN GOD FOR ALL THINGS WORK WELL FOR THE BELIEVERS 25

Cyberwave Solutions

Inspired by the great works of God

Philippians 4:13

Proverbs 16:3

Tricks to ace paper 2 exams CS

 Regular coding practice


 Think outside the box before writing your everyday code
 Apply programming to your day to day life i.e create pure mathematics
,physics ,chemistry, cs ,geography math solving tools yeah u heard me
 Remember nobody is born a genius, never be afraid to ask
 GPT is an assistant, never tell it to do your programming assignments
because those assignments are there to stretch you not to trouble you
 Have computer science related dreams in your mind at all times when
you study, it will naturally push you to work harder

~PRAYER ALWAYS WINS~

0716057680 For programming tutorials


Services l also offer

 Chatbot services
 Youtube Tutorials
 Project Assistance

~Thanks for your unending support

Paper2 |[email protected] also [email protected] Don’t forget to pray 25


always

You might also like