Data representation and security · GCSE Computer Science

Logic gates and truth tables

GCSE Computer Science logic gates: AND, OR, NOT and XOR, how to fill a truth table including a 3-input circuit, and how to turn English into gates.

UNDERSTANDRETRIEVEREMEMBER
THE MEMORY HOOK
AND is fussy (both 1). OR is generous (at least one 1). NOT flips. XOR is 1 when the inputs differ. A 3-input table has 8 rows — count in binary and never skip a combination.

The important bits

What you need to know

  1. 1

    Boolean values are 1 or 0 (TRUE or FALSE). Logic gates combine them in hardware; IF conditions combine them in software. The truth table is the proof.

  2. 2

    NOT has one input and inverts it: 0→1, 1→0. Two rows. Drawn as a triangle with a bubble, or written ¬A or A with a bar.

  3. 3

    AND outputs 1 only if every input is 1. Two-input AND is 1 only on the 11 row. Three-input AND is 1 only on the 111 row.

  4. 4

    OR outputs 1 if at least one input is 1. Only all-zeros gives 0. This is inclusive OR, not XOR, unless the paper draws the extra exclusive-or symbol.

  5. 5

    XOR (EOR) is 1 when the inputs are different: 01 and 10 are 1; 00 and 11 are 0. Do not confuse it with OR, which is also 1 on 11.

  6. 6

    A truth table for n inputs has 2ⁿ rows. Two inputs: 4 rows. Three inputs: 8 rows from 000 to 111. List them in binary counting order so you do not miss a row.

  7. 7

    Add a column per gate in signal-flow order. Never jump to the final output in your head on a multi-gate circuit. Intermediate columns are method marks.

  8. 8

    Brackets follow the circuit: A AND (B OR C) is not (A AND B) OR C. Translate English carefully: exam “or” is inclusive unless they specify XOR or “not both”.

Quotations worth analysing

Short evidence. Real method.

AND outputs 1 only if all inputs are 1.
GCSE AND definition

“All inputs”, not “at least one”. On a 3-input AND, seven of the eight rows are 0. That last row is the whole gate.

OR outputs 1 if at least one input is 1.
GCSE OR definition

Inclusive: 1 OR 1 is 1. XOR would be 0 on that row. Name which gate you mean.

A 3-input circuit has 8 combinations of inputs.
Truth-table size phrase

2³ = 8. Starting at 000 and counting to 111 is how you prove you did not skip 101. Four rows on a 3-input question is an incomplete table.

Go deeper

Building a 3-input table without heroics

Suppose inputs A, B, C and a circuit that computes (A AND B) OR NOT C. There are eight rows from 000 to 111. First columns: A, B, C in binary counting order so you do not miss a combination. Next column: A AND B. Next: NOT C. Last: OR those two together. If you skip the intermediate columns you will mis-copy a wire. This is the same discipline as a trace table. For 5-mark questions they often give a half-filled table — complete it, then write the expression. If they ask whether two circuits are equivalent, compare output columns; do not argue from how neat the drawing looks. Work one row as a check: A=1, B=1, C=0 → AND=1, NOT C=1, OR=1. If your final column disagrees, the broken gate is the one whose output does not match its own inputs.

Go deeper

From English to gates, then prove it

“The lamp lights if the switch is on and the door is closed, or if the override is pressed.” That is (Switch AND NOT DoorOpen) OR Override — or (Switch AND DoorClosed) OR Override depending on the sensor name. English “or” sometimes means XOR (“tea or coffee”) and sometimes inclusive OR. In GCSE circuits, OR is inclusive unless they specify XOR. Draw the gates, label the wires, then pick one row of the truth table and walk the 1s through as a check. Three inputs means eight rows even if one input is an override you think of as rare — rare is still a row. If a 6-mark question gives a faulty table, find the gate whose output column does not match its inputs; that is the broken component. Do not redraw a different circuit that would have been nicer.

WORKED EXAMPLE

See the idea in action

Circuit: Q = (A AND B) XOR C. Three inputs, eight rows. Columns: A B C | A AND B | Q 000: AND=0, 0 XOR 0 = 0 001: AND=0, 0 XOR 1 = 1 010: AND=0, 0 XOR 0 = 0 011: AND=0, 0 XOR 1 = 1 100: AND=0, 0 XOR 0 = 0 101: AND=0, 0 XOR 1 = 1 110: AND=1, 1 XOR 0 = 1 111: AND=1, 1 XOR 1 = 0 If this had been (A AND B) OR C, row 111 would be 1, not 0. That single row is why XOR is not OR. A two-gate NAND example: NOT (A AND B) gives outputs 1,1,1,0 on AB = 00,01,10,11. Different circuit, still fill every row.

Exam technique

Turn knowledge into marks

Learn the four gate shapes until you cannot mix them under time pressure. For 3 inputs write eight rows 000–111, add a column per gate, and only then fill the output. A correct table on the wrong symbol is still wrong.

Common mistakes

Do not give these marks away

  1. 01

    Mixing up AND and OR output rows, or treating XOR as OR on the 11 row.

  2. 02

    Writing only four rows for a 3-input circuit, or skipping combination 101.

  3. 03

    Writing A AND B OR C without brackets, then evaluating in a different order from the circuit.

QUICK RETRIEVAL

How many rows does a truth table for a 3-input logic circuit need?

A3

B4

C6

D8

Show the answer

8. Each input is 0 or 1, so there are 2³ = 8 combinations, listed 000 to 111. Four rows would only cover two inputs. Three rows would only list the three inputs, not their combinations.

Quick questions

If this is the bit you searched

What is the difference between OR and XOR GCSE?

OR is 1 if at least one input is 1, including when both are 1. XOR is 1 only when the inputs are different, so both 1 gives 0.

How do you complete a truth table for a logic circuit?

List every input combination in binary order, add a column for each gate in the order the signals flow, and fill those columns before the final output.

When is a 3-input AND gate 1?

Only when all three inputs are 1. The other seven combinations output 0.

Do I need Boolean algebra laws at GCSE?

Know simple identities and that brackets follow the circuit. Heavy simplification is less common than truth tables, but A AND NOT A = 0 is a useful check.