Boolean logic and logic circuits – O Level Computer Science (2210)
Question text
6
Consider the logic expression:
X = (J XOR NOT K) NAND NOT L
(a) Draw a logic circuit for the logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify the logic expression.
J
K
X
L
[4]
(b) Complete the truth table for the given logic expression.
Working space
J
K
L
X
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
[4]
ĬÓĊ®Ġ´íÈõÏĪÅĊßüµĀ×
Question text
4
(a) Tickets for a theme park are booked online. An adult ticket costs $12.99 and a child ticket
costs $7.99. A booking fee of $1.99 is added to the total cost of each booking.
Write an algorithm in pseudocode to:
•
input the number of adult tickets for a booking
•
input the number of child tickets for a booking
•
calculate and output the total cost of the booking using an appropriate message.
…
…
…
…
…
…
…
… [4]
(b) Each booking must have at least one adult ticket.
Explain how the algorithm could be changed to repeatedly ask for the number of adult tickets
if the number input is less than 1.
Any code used must be fully explained.
…
…
…
…
…
…
…
… [4]
ĬÏĊ®Ġ´íÈõÏĪÅĊßù·þ×
,
,
(c) The theme park has rules for a person to be able to go on a ride.
A person can go on a ride (X = 1) only if they:
•
are 1.4 metres tall or over
•
are 12 years old or over
•
do not have a medical condition.
Input
Description
Binary value
under 1.4 metres
0
A
1.4 metres or over
1
under 12 years old
0
B
12 years old or over
1
does not have a medical condition
0
C
has a medical condition
1
(i)
Write the logic expression for this problem.
X = … [2]
(ii)
Complete the truth table for this problem.
Working space
A
B
C
X
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
[4]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝû·Ā×
Question text
9
Consider the logic expression:
X = (NOT P OR Q) NAND (Q XOR R)
(a) Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify the logic expression.
P
Q
X
R
[4]
(b) Complete the truth table for the given logic expression.
Working space
P
Q
R
X
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
[4]
ĬÑĊ®Ġ´íÈõÏĪÅĊßù¶Ā×
Question text
3
Four logic gates and five logic gate symbols are shown.
Draw one line to link each logic gate to its correct symbol. Not all logic gate symbols will be used.
Logic gate symbol
Logic gate
AND
NAND
NOR
XOR
[4]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝú·þ×
Question text
8
A logic circuit is to be built to control the automatic opening of a window. The window W opens if
the temperature T is too high, the heater H is off, and the air conditioning A is off.
air conditioning off
0
air conditioning A
air conditioning on
1
not too high
0
temperature T
too high
1
heater off
0
heater H
heater on
1
window closed
0
window W
window open
1
Complete the truth table for this problem.
A
T
H
W
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
[4]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞü¶þ×
Question text
9
Consider the logic expression:
Z = (A NAND B) OR NOT (B XOR C)
(a) Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify this logic expression.
A
Z
B
C
[4]
(b) Complete the truth table from the given logic expression.
Working space
A
B
C
Z
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
[4]
Question text
6
There are three descriptions of logic gates. Each logic gate has two inputs A and B with one
output X.
Identify each logic gate.
Complete a truth table for each logic gate.
(a) The only time the output is 1 is when both inputs are 1.
A
B
X
Logic gate …
0
0
Complete the truth table for this description.
0
1
1
0
1
1
[2]
(b) The output is 1 when both inputs are different.
A
B
X
Logic gate …
0
0
Complete the truth table for this description.
0
1
1
0
1
1
[2]
(c) The only time the output is 1 is when both inputs are 0.
A
B
X
Logic gate …
0
0
Complete the truth table for this description.
0
1
1
0
1
1
[2]
(d) Consider this logic expression:
X = (NOT A OR NOT B) OR NOT C
Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two
inputs. Do not attempt to simplify this logic expression.
A
B
X
C
[5]