Skip to content
Brainlag

Theme

Colour

Logic gates and truth tables

GCSE Computer Science Updated Wed 7 Oct 2026

Logic gates are the building blocks of a processor. Each one takes inputs that are 0 or 1 and gives an output by a fixed rule, and a truth table lists the output for every possible input.

Part 1 of 3: Learn it

In short

  1. AND outputs 1 only if both inputs are 1; OR outputs 1 if at least one input is 1; NOT flips its input.
  2. A truth table with n inputs has 2ⁿ rows: 2 inputs give 4 rows, 3 inputs give 8.
  3. Work through a circuit one gate at a time, adding a column for each gate's output.

Where this is in your specification

Spec points: AQA 3.4.2, OCR 2.4.1, Edexcel Topic 3

BoardTopic: Boolean logic
AQA 85253.4.2
Edexcel 1CP2Topic 3 (logic)
OCR J2772.4.1

The gates

GateRuleExpression
NOToutput is the opposite of the inputNOT A (also written ¬A or A with a bar over it)
ANDoutput is 1 only when both inputs are 1A AND B (A ∧ B, or A.B)
ORoutput is 1 when either or both inputs are 1A OR B (A ∨ B, or A + B)
XORoutput is 1 when exactly one input is 1A XOR B (A ⊕ B)

OCR's GCSE uses NOT, AND and OR; AQA and Edexcel add XOR. The gate symbols and the way expressions are written differ a little between boards, so use the ones in your own specification.

Truth tables for AND and OR

ABA AND BA OR B
0000
0101
1001
1111

List the inputs in binary counting order (00, 01, 10, 11) so you never miss a row.

Circuits with more than one gate

Label the output of each gate (for example D and then Q), add a column for each, and fill them in left to right. The expression follows the wiring: if A and B go into an AND gate whose output goes into a NOT gate, the circuit is Q = NOT (A AND B).

Quick check

What is 1 AND 0?

Show the answer

0.

Part 2 of 3: See it worked

Worked examples

Example 1

Complete the truth table for Q = (A AND B) OR (NOT C).

  1. 3 inputs, so 8 rows: A, B, C from 000 to 111
  2. Column D = A AND B: 1 only in rows 110 and 111
  3. Column E = NOT C: 1 when C = 0
  4. Q = D OR E: 1 when either column is 1

Answer: Q is 1 for inputs 000, 010, 100, 110 and 111, and 0 for 001, 011 and 101.

Example 2

A security light comes on (L = 1) when it is dark (D = 1) and either movement is detected (M = 1) or the override switch is on (S = 1). Write the expression.

  1. 'Either ... or' joins M and S with OR
  2. 'and' joins that with D

Answer: L = D AND (M OR S).

Common mistakes

  • Missing rows: a 3-input table needs all 8 combinations.
  • Treating OR as 'one or the other but not both'. That is XOR; OR is also 1 when both are 1.
  • Dropping brackets when writing the expression from a diagram.
  • Drawing an OR gate when the question uses the AND symbol, or mixing the curved and flat shapes.
Quick check

What is NOT (0 OR 0)?

Show the answer

NOT 0 = 1.

Part 3 of 3: Test yourself

Check yourself

Answer each one in your head or on paper first, then open it to check.

What is 1 AND 0?

0.

What is NOT (0 OR 0)?

NOT 0 = 1.

How many rows does a truth table with 4 inputs need?

2⁴ = 16.

Jobs that use this

Each link opens the job profile on the National Careers Service (England). In the rest of the UK: My World of Work (Scotland), Careers Wales, nidirect careers (Northern Ireland).

Full lessons and marked practice for this course are coming soon to Brainlag Learn. See courses