Truth tables with three inputs

Real systems often depend on more than two things. A burglar alarm checks doors, windows and whether it is switched on. Here is how to work out every possibility.

Practise this lesson free (7 questions)

How many rows?

Each input can be 0 or 1. Every extra input doubles the number of rows.
1 input: 2 rows. 2 inputs: 4 rows. 3 inputs: 2 × 2 × 2 = 8 rows.
List them in binary order: 000, 001, 010, 011, 100, 101, 110, 111, so you never miss one.

A burglar alarm

D = a door is open, W = a window is open, S = the alarm is switched on (1 = yes).
The alarm sounds if (a door OR a window is open) AND it is switched on.
Alarm = (D OR W) AND S
DWSD OR WAlarm
00000
00100
01010
01111
10010
10111
11010
11111

Logic in programs

The same expression can be written in Python:
door = True
window = False
switched_on = True
print((door or window) and switched_on)
prints True.
Brackets matter: work out the inside first, just like in maths.
Worked example

Q = (A AND B) OR (NOT C). Find Q when A = 1, B = 0, C = 0.

  1. A AND B = 1 AND 0 = 0.
  2. NOT C = NOT 0 = 1.
  3. 0 OR 1 = 1.

Answer: Q = 1

Key idea

A truth table with n inputs has 2 to the power n rows, so 3 inputs give 8 rows. List the inputs in binary order and work out the brackets first.

Key words
AND
A Boolean operator that gives True (1) only when both inputs are True.
Truth table
A table showing the output of a logic gate or Boolean expression for every possible combination of inputs.
List
A data structure that stores many items under one name, in order, such as scores = [4, 7, 2].
Binary
A number system that uses only two digits, 0 and 1. Computers store all data in binary.
Input
Data put into a computer, for example from a keyboard, mouse, microphone or sensor.

All KS3 Computing key terms and definitions →

Extra practice

2 more questions

Try each one, then tap to check.

  1. How many rows (not counting the heading) does a truth table with 2 inputs have?

    Show the answer

    Answer: 4

    22 = 4 rows.

  2. How many rows does a truth table with 3 inputs have?

    Show the answer

    Answer: 8

    23 = 8.

Check you have got it

Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.

Related lessons