Computer science Paper 2
6023
SECTION A
1(a) Logic Circuit
C
S
Truth Table
T C V NOT V T AND C V’ AND C S
0 0 0 1 0 0 0
0 0 1 0 0 0 0
0 1 0 1 0 1 1
0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 0 0 0
1 1 0 1 1 1 1
1 1 1 0 1 0 1
Computer science Paper 2
6023
(b)Von Neumann Buses
Central
Input/output
processing Memory Unit
devices
Unit(CPU)
Control Bus
Adress Bus
Data Bus
System Bus
Computer science Paper 2
6023
SECTION B
4(a) Trace Table
OUTPUT
x X A
1 2 1
2 3 4
3 4 9
(b) Recursive Function
START
Function factorial (n)
Input n
While n>0 Do
IF n=0 THEN
Output “1”
Else
n= n*Factorial (n-1)
End if
End While
STOP
i. Interface Design
(ii)Program code
Computer science Paper 2
6023
Public Class Form1 ‘By Tinotenda Maisiri
Dim amountinvested As Integer
Dim numberofyears As Integer
Dim interestrate As Percantage
Dim balance As Integer
Dim Interest As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
amountinvested = TextBox1.Text
numberofyears = TextBox2.Text
If amountinvested >=500 And < =1000 Then
interestrate= 10%
interest= (10/100) * amountinvested
balance = amountinvested -Interest
If
"amountinvested" <1000 And <=2000 Then
interestrate= 15%
interest= (15/100) * amountinvested
balance = amountinvested -Interest
Else
"amountinvested" >2000 Then
interestrate = 20%
Interest = (20 / 100) * amountinvested
balance = amountinvested - Interest
End If
End If
MsgBox.Show("Interest", Interest,vbTab ,"Interestrate",
interestrate,vbTab,"Balance",balance,vbTab,"investedamount" ,amountinvested
vbTab,"Nember of years",numberof years)
SECTION C
Computer science Paper 2
6023
6(a) ERD Diagram
First name Surname Surname First name
E.C Number
Registration
Number
Registration Teacher Student
Number
Leave days
Salary
Adress Class
Adress
Registration
Number
Ancillary Worker Surname
Salary
Adress First name
Hours Worked
(b) SQL Statements
SELECT customer name, address
FROM tblDebtors
WHERE days =60 AND Amount >30 ORDER BY DESC
(c) SQL Statements
DELETE FROM tblDebtors
WHERE customer name =Mr Mara
(d) How to connect data base to IDE language
Computer science Paper 2
6023
I created the database
Click External data on the tool Bar
Click here
Then click More And CLICK OBDC DATABASE
Click here