← IGCSE Computer Science Paper 2

Completing a truth table from a problem statement

Write the problem statement as an expression like this, then find X for every row of the table: put 1 where the statement is true and 0 where it is false.

Understanding Completing a truth table from a problem statement in IGCSE Computer Science Paper 2

What it does: Door open = A, system on = B, panic button = C. 'AND' joins A and B in brackets, then 'OR' adds C. Each of the three inputs can be 0 or 1, so there are 2 x 2 x 2 = 8 rows, and X is worked out for each one. The word AND means both conditions must be true, so X is 1 only when A and B are both 1. A AND B is 0, but C is 1, and 0 OR 1 gives 1. The statement is true in this row. 1 means true. Write 1 in the X column for every row where the situation in the statement is true, and 0 where it is false.

Common mistakes: With A=1 and B=1, A AND B is 1, so (A AND B) OR C is 1 even when C is 0. The line should say X = 1. The statement says A or B, so the expression must use OR, not AND. It should be X = A OR B.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 562–580) and word search (Modules 539–580).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A alarm sounds (X = 1) if the door is open (A) AND the system is armed (B). Which expression should you write before filling in the table?
X = A AND BX = A OR B
Matches
Row A=0, B=1, C=0: (A AND B) OR C = 1, so X = 1
↓
A AND B is 0 AND 1 = 0, and C is 0, so 0 OR 0 = 0. X should be 0, not 1. Only put 1 where the statement is true.
Applying
Meanings
Term
X = (A AND B) OR C
Meaning
Write the problem statement as an expression like this, then find X for every row of the table: put 1 where the statement is true and 0 where it is false.
Practice
X = (A AND B) OR C
Testing
Gaps
X = (A B) OR C
Check Answer
Spots
2X = (A AND B) OR C
3Row 1,1,0 gives X = 0

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Gila Monster' badge — Patient Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A alarm sounds (X = 1) if the door is open (A) AND the system is armed (B). Which expression should you write before filling in the table?
A. X = A OR B
B. X = A AND B ✓
The word AND means both conditions must be true, so X is 1 only when A and B are both 1.
2. A truth table for a three-input problem statement needs how many rows?
A. 6 rows
B. 8 rows ✓
With three inputs there are 2 x 2 x 2 = 8 different combinations of 0 and 1.
3. Statement: a light turns on if switch A is on AND switch B is on, OR if switch C is on. For the row A = 0, B = 1, C = 1, what is X in X = (A AND B) OR C?
A. X = 1 ✓
B. X = 0
A AND B is 0, but C is 1, and 0 OR 1 gives 1. The statement is true in this row.
4. When you complete the output column from a problem statement, what do you write in a row where the statement is true?
A. 1 ✓
B. 0
1 means true. Write 1 in the X column for every row where the situation in the statement is true, and 0 where it is false.
5. A pump runs (X = 1) if the tank is empty (A) AND it is NOT raining (B). Which expression matches this statement?
A. X = A AND (NOT B) ✓
B. X = A AND B
The words NOT raining mean B must be 0 for the pump to run, so NOT must be applied to B.

Match the Pairs

X = (A AND B) OR C → The output X is 1 when both A and B are 1, or when C is 1. Use this expression to work out X for each row of the truth table.
A=1, B=0, C=1 gives X = 1 → Reading one row as a situation: A AND B is false, but C is true, so the OR makes the statement true and X is 1.
A problem statement says: the alarm sounds if the door is open AND the system is on, OR if the panic button is pressed. Write it as an expression. → X = (A AND B) OR C
With three inputs, the truth table needs every combination, so you work out X for this many rows. → 2 x 2 x 2 = 8 rows
Row A=0, B=1, C=0: (A AND B) OR C = 1, so X = 1 → A AND B is 0 AND 1 = 0, and C is 0, so 0 OR 0 = 0. X should be 0, not 1. Only put 1 where the statement is true.
Truth table for X = (A AND B) OR C has only 4 rows → There are three inputs (A, B and C), so the table needs 8 rows, not 4. Four rows would only cover two inputs.

Key Term

X = (A AND B) OR C
Write the problem statement as an expression like this, then find X for every row of the table: put 1 where the statement is true and 0 where it is false.

Fill in the Blanks

1. // X is 1 when A and B are both 1, or C is 1 X = (A AND B) OR C
Hint: Type the gate word that is true only when both A and B are 1.
2. // X is 1 if the bracket is 1, or C is 1 X = (A AND B) OR C
Hint: Type the gate word that joins the bracket and C so that either one being 1 makes X 1.
3. X = (A AND B) OR C A=1, B=0, C=1 -> X = 1
Hint: Work out the bracket first, then type the output X for this row.
4. X = (A OR B) AND C A=1, B=1, C=0 -> X = 0
Hint: Check what AND does when one input is 0, then type the output X for this row.
5. // X is 1 when A is 1 and C is 0 X = A AND NOT C
Hint: Type the gate word that turns C into its opposite, so a 0 counts as true.

Spot the Error

Question 1
A A=door, B=window, C=panic
B X = (A AND B) OR C
C Row 1,1,0 gives X = 0
Line C — With A=1 and B=1, A AND B is 1, so (A AND B) OR C is 1 even when C is 0. The line should say X = 1.
Question 2
A Lamp on if A or B is on
B X = A AND B
C Row A=0,B=0 gives X = 0
Line B — The statement says A or B, so the expression must use OR, not AND. It should be X = A OR B.
Question 3
A Three inputs A, B, C
B Rows = 2 x 2 = 4
C Rows go 000, 001, ... 111
Line B — Three inputs double the rows three times, so there are 2 x 2 x 2 = 8 rows. 2 x 2 = 4 is the count for two inputs.
Question 4
A X = (A OR B) AND C
B Row A=1,B=0,C=1
C (1 OR 0) AND 1 = 1, so X = 0
Line C — The working gives 1, so X must be 1 for this row. The line should end with so X = 1.
Question 5
A X = A AND NOT B
B Row A=1,B=1
C NOT B = 1, so X = 0
Line C — B is 1, so NOT B is 0, not 1. The line should read NOT B = 0, so X = 0.

Student with a class code? Join your class →