Boolean logic – IGCSE Computer Science (0478)
Quick quiz: 10 random questions from this topic. Answer them all, then open the Summary.
Question text
3
AND, OR and XOR are three examples of logic gates.
(a) Four statements are given about these logic gates.
Tick (3) to show which statements apply to each logic gate. Some statements may apply to
more than one logic gate.
AND
OR
XOR
Statement
(3)
(3)
(3)
if both inputs are 0, the output is 0
if both inputs are different, the output is 1
if both inputs are 1, the output is 1
if both inputs are the same, the output is always 0
[4]
(b) NOT, AND, OR and XOR are all examples of logic gates.
State the name of two other logic gates and complete a truth table for each.
Logic gate 1 …
Truth table:
A
B
Output
0
0
0
1
1
0
1
1
Logic gate 2 …
Truth table:
A
B
Output
0
0
0
1
1
0
1
1
[4]
Question text
7
NAND, OR and XOR are three types of logic gate.
(a) Four statements are shown about the logic gates.
Tick (✓) to show which statements apply to each logic gate. Some statements may apply to
more than one logic gate.
NAND
OR
XOR
Statement
(✓)
(✓)
(✓)
if both inputs are 1, the output is 1
if both inputs are different from each other, the output is 1
if both inputs are 0, the output is 0
if both inputs are the same as each other, the output is always 0
[4]
(b) NAND, OR, XOR, NOR and NOT are all examples of logic gates.
State the name of one other logic gate and complete its truth table.
Logic gate …
Truth table:
A
B
Output
0
0
0
1
1
0
1
1
[2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
5
A computer-controlled machine produces plastic sheets. The thickness of each sheet must be
within a certain tolerance. The sheets are kept below 50 °C as they move over rollers at 10 metres
per second.
Three parameters need to be monitored all the time.
Binary
Parameter
Description
Conditions
value
1
thickness of sheet in tolerance
D
sheet thickness
0
thickness of sheet out of tolerance
1
roller speed = 10 metres/second
S
roller speed
0
roller speed <> 10 metres/second
1
temperature < 50 °C
T
temperature
0
temperature >= 50 °C
An alarm, X, will sound if:
thickness is in tolerance AND (roller speed <> 10 metres/second OR temperature >= 50 °C)
OR
roller speed = 10 metres/second AND temperature >= 50 °C
(a) Draw a logic circuit to represent the above monitoring system.
D
S
X
T
[6]
(b) Complete the truth table for the monitoring system.
Working Space
D
S
T
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) A restaurant offers a fixed priced menu. A meal for an adult costs $9.99 and a meal for a child
costs $6.99.
If there are 6 or more people at a table, a 15% discount is applied to the total cost of the
order.
Write an algorithm in pseudocode to:
•
input the number of adults and the number of children at a table
•
calculate the total cost of the order with the discount, if this applies
•
output the final cost of the order.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
(b) The final cost of the order after the discount may have more than 2 decimal places.
Write a pseudocode statement to set the final cost of the order to 2 decimal places.
You do not need to rewrite the whole algorithm.
…
… [2]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝü¸þ×
,
,
(c) The restaurant offers a discount on a meal if the person ordering is either a student or is 65
years or older. The discount (X = 1) can only be given if the amount of the order is $20.00 or
over.
a student
0
rule A
not a student
1
under 65 years old
0
rule B
65 years or older
1
under $20.00
0
rule C
$20.00 or over
1
(i)
Write the logic expression for this problem.
… [2]
(ii)
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
B
X
C
[3]
(d) Draw the NAND logic gate symbol and complete the truth table for it.
NAND logic gate symbol:
Truth table:
A
B
X
0
0
0
1
1
0
1
1
[2]
ĬÕĊ®Ġ´íÈõÏĪÅĊßú¸Ā×
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
5
Computers use logic gates.
(a) State the single logic gate that produces each truth table.
Truth table
Logic gate
A
B
Output
0
0
1
0
1
1
…
1
0
1
1
1
0
A
B
Output
0
0
0
0
1
1
…
1
0
1
1
1
0
A
B
Output
0
0
1
0
1
0
…
1
0
0
1
1
0
[3]
(b) An aeroplane has a warning system that monitors the height of the aeroplane above the
ground, whether the aeroplane is ascending or descending, and the speed of the aeroplane.
Input
Binary value
Condition
1
Height is less than 500 metres
Height
(H)
0
Height is greater than or equal to 500 metres
Ascending or
1
Aeroplane is ascending or in level flight
Descending
0
Aeroplane is descending
(A)
1
Speed is less than or equal to 470 knots
Speed
(S)
0
Speed is greater than 470 knots
The warning system will produce an output of 1 that will sound an alarm (W) when either of
these conditions apply:
Height is less than 500 metres and the aeroplane is descending
or
The aeroplane is descending and speed is greater than 470 knots
Draw a logic circuit to represent the warning system.
H
A
W
S
[5]
Question text
10 Consider the following logic statement:
X = (((A OR B) OR (NOT (B XOR C))) AND C)
(a) Draw a logic circuit to represent the given logic statement.
Do not attempt to simplify the logic statement. All logic gates must have a maximum of two
inputs.
A
B
X
C
[5]
(b) State the name of a logic gate that does not appear in the logic statement and draw the
symbol for the logic gate.
Name of logic gate …
Logic gate symbol:
[2]
(c) Complete the truth table for the given logic statement.
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
6
Consider the logic statement:
X = 1 if ((A is NOT 1 OR B is 1) NOR C is 1) NAND ((A is 1 AND C is 1) NOR B is 1)
(a) Draw a logic circuit to represent the given logic statement.
A
B
X
C
[6]
(b) Complete the truth table for the given logic statement.
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
7
(a)
$
;
%
&
Complete the truth table for this logic circuit.
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]
(b) Draw a logic circuit corresponding to the following logic statement:
X = 1 if ( ( A is 1 OR B is 1 ) AND ( A is 1 AND B is 1 ) ) OR ( C is NOT 1 )
$
%
;
&
[5]
(c) Re-draw the following logic circuit using NAND gates only.
$
;
%
&
Logic circuit re-drawn:
$
%
;
&
[4]
Question text
11
Consider the following logic statement:
X = (((A AND B) OR (NOT (B OR C))) NAND C)
(a) Draw a logic circuit to represent the given logic statement.
Do not attempt to simplify the logic statement. All logic gates must have a maximum of two
inputs.
A
B
X
C
[5]
(b) Complete the truth table for the given logic statement.
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]
(c) Identify two logic gates that are not included in the given logic statement.
Logic gate 1 …
Logic gate 2 …
[2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of