SECTION A
Answer 1 question from this section
1 (a) Given the following logic statement:
X=1 if (A=1 AND B=NOT 1) OR (B=1 AND C=NOT 1);
(i) draw the logic circuit
B X
[6]
(ii) create the truth table.
A B C B’ C’ A. B’ B. C’ X
0 0 0 1 1 0 0 0
0 0 1 1 0 0 0 0
0 1 0 0 1 0 1 1
0 1 1 0 0 0 0 0
1 0 0 1 1 1 0 1
1 0 1 1 0 1 0 1
1 1 0 0 1 0 1 1
1 1 1 0 0 0 0 0
[8]
(b) Draw a well-labelled diagram that illustrates how a processor, 1/0 devices and the
memory unit are linked by connections known as buses.
[6]
2 A boiler (B) will be ON if:
- the timer (C) is ON and temperature sensor (T) is OFF
OR
- Timer (C) is OFF and frost sensor (F) is ON.
(a) Deduce the
(i) Boolean statement
B = 1 if (C=1 AND T=IS NOT1) OR (C= IS NOT1 AND F =1)
[3]
(ii) Boolean expression.
C.T’+C’.F = B
[3]
(b) Draw a logic circuit for the system.
C
T X
F
[5]
(c) Produce a truth table for the system. [4]
(d) Draw a simplified and well-labelled diagram of a Havard Computer Architecture.
[5]
SECTION B
This section consists of 3 questions
Answer 2 questions from this section
Answer question 1 and any other from this section
QUESTION 1
Xolani is a programmer at ABC Building Contractors. He is required to develop a program
to calculate employee wages at the end of each week. The program is expected to collect the
following information from the user.
Employee Name
Number of hours worked
The program then computes and outputs the following information.
Normal pay
Overtime pay
Tax
Gross pay
Net pay
After calculating pay for one employee, the program should re-initialise the interface for the
next employee's details to be accepted and processed.
Notes
Normal working hours 40
Normal rate per hour $8.00
Overtime rate per hour $12.00
Tax rate (Overtime not taxed) 10%
a) Design a user interface for the program. [10]
b) Write the program corresponding to the user interface in part (a) that fulfils the
requirements of the system.
[30]
QUESTION 2
2)a) Write an algorithm of a program that accepts 10 numbers from the keyboard and outputs
the highest, lowest, sum and average of all the numbers entered [10]
b) Covert the algorithm in ( a) into a program using the programming language of your
choice [10]
c) A series of characters J, F,H,U,S,X,T are to be entered into a binary search tree in the order
given
Draw a binary search tree to show how these characters will be stored [8]
d) Traverse the produced binary tree using
i) in-order transversal. [2]
ii) post-order transversal [2]
iii) pre-order transversal [2]
e) Using pseudo codes write a bubble sort algorithm that can be used to arrange the elements
in a descending order. [6]
QUESTION 3
a)Write a pseudocode that accepts distance of a journey in (km) and time in (hrs) and
calculates the speed. The speed is categorised as below. If speed is
i) 1-44km/hr – “SLOW”
ii) 45- 80km/hr- “ NORMAL”
iii) Above 80km/hr “HIGH” [8]
b) Using a programming language of your design an interface to write a program for the
above pseudocode [4]
c ) Write a program that calculates the speed and displays the speed category [8]
d) The following is a pseudo code of a program that was designed to add 10
positive numbers.
Counter = 1
For counter = 1 to 10
Repeat
Print “Enter a positive whole number”
Input number
Until number <0
Total = Total + counter
Counter = counter +1
Output Total
Next
(i) The pseudo code contains several errors.
Identify and write down all the errors. [7]
(ii) Rewrite the algorithm so that it is effective and error free. [5]
e) Construct flowcharts for the following
i) Nested IF statement [3]
ii) sequence [2]
iii) bottom tested loop [2]