GCSE Computer Science · public explanation

Logic Gates and Truth Tables

Build truth tables for logic gates and follow their binary inputs and outputs. Explore AND, OR and NOT, with GCSE board guidance on additional gates.

Read the explanation and worked examples, then choose your exam board to continue with activities and practice in your account.

OCR J277On the specificationOCR J277 2.4.1

Use AND, OR and NOT to interpret, complete and compare scenario-based logic circuits and truth tables.

AQA 8525 (2027+)On the specificationAQA 8525 3.4.2

Interpret Boolean gates, expressions, circuits and truth tables in computing concepts. Both supported editions include XOR and symbolic operator notation.

Turn a yes-or-no condition into a signal

Suppose an exhibit cabinet has a door sensor. A means 'the door is open'. A = 1 means that statement is true; A = 0 means it is false. A is one Boolean input: it has two possible values, not a measurement of how far the door is open.

A logic gate applies a fixed rule to its input signal or signals and produces one output signal. The same input combination always gives the same output for that gate. Read the rule before trying to predict the output.

In a truth table, every row is a separate possible situation. A zero is a known false value. An empty output cell means 'not filled in yet', not false.

NOT reverses one input

NOT A asks for the opposite of A. When the cabinet door is closed, A = 0, so NOT A = 1: 'the door is not open' is true. When the door is open, A = 1 and NOT A = 0.

A NOT gate has one input. Its diagram uses a triangle with a small circle at the output. The circle indicates inversion: changing 0 to 1 and 1 to 0. It is not a second input or an extra Boolean value to add.

A: door openNOT A: door not open
01
10

AND needs both conditions

The cabinet also has nearby-movement input B and armed input C. B = 1 means movement is detected; C = 1 means the warning system is armed. A movement warning should be active only when both statements are true, so this part of the rule is B AND C.

For B = 1 and C = 0, movement is detected but the system is not armed. The output is 0. For B = 1 and C = 1, both conditions hold, so the output is 1. One true input is not enough.

The AND symbol has a flat input side and a rounded output side. Two input wires enter the flat side; one output leaves the rounded side. The shape names a rule, not a physical doorway through which the values pass.

B: movementC: armedB AND C
000
010
100
111

OR includes the case where both inputs are 1

Now look at the two sensor readings: A means door open and B means nearby movement. A OR B asks whether at least one sensor reports its condition. Inputs 01 and 10 both produce 1. Inputs 11 also produce 1: 'at least one' allows both.

Only 00 produces 0, because neither condition is true. This is inclusive OR. It does not mean 'one, but not both', and it does not add the inputs to produce 2.

The OR symbol has a curved input side and narrows to a point at its output. Follow the two input wires to the gate and the single output wire away from it.

ABA OR B
000
011
101
111

List every combination once

One input has two possibilities: 0 and 1. With two inputs, pair each A value with both B values: 00, 01, 10, 11. That gives four rows. The rightmost input changes on every row; the leftmost changes after two rows.

With three inputs, the eight combinations are 000, 001, 010, 011, 100, 101, 110 and 111. Each added Boolean input doubles the possibilities. Do not omit 000: all inputs being false is still a valid situation to test.

Keep a ruler-like focus on one row. Read its inputs, apply the named gate's rule, then enter that row's output. Do not carry an output from the previous row into the next situation.

ABA AND BA OR B
0000
0101
1001
1111

AQA focus

AQA: XOR detects different inputs

XOR, exclusive OR, produces 1 when its two inputs differ. Suppose a fault indicator should light when two readings disagree. Readings 01 and 10 activate it; 00 and 11 do not. That is a different requirement from 'at least one reading is 1'.

Compare OR and XOR on input 11. OR gives 1 because at least one input is true. XOR gives 0 because the two inputs are the same. This one row distinguishes their rules; both give 1 on 01 and 10.

The XOR gate symbol resembles OR but has an extra curved line beside the input side. AQA requires XOR in both supported specification editions. OCR J277's required gate set here is NOT, AND and OR.

ABA OR BA XOR B
0000
0111
1011
1110

Continue with your exam board

The course combines lesson videos, interactive activities, topic questions and original exam mocks. Sign in to use the learning tools and save your progress; your account’s course access applies.

Independent learning resources. Not endorsed by AQA or OCR. These public introductions complement the full course and the official specification.