Logic Gates and Truth Tables for GCSE Computer Science

A logic gate is an electronic component that takes one or two binary inputs (0 or 1) and produces a single binary output according to a fixed logical rule. Every processor, memory chip, and digital circuit in every computer is built from billions of these gates working together.

Why do logic gates matter for GCSE computing?

At the hardware level, computers perform all calculations using combinations of logic gates — the transistors in a CPU implement AND, OR, and NOT operations in silicon. The GCSE Computer Science specifications (AQA, OCR, Edexcel) require students to draw and interpret truth tables for the basic gates, combine gates into simple circuits, and trace the output of a logic circuit for given inputs. This topic also reinforces Boolean algebra from the KS3 curriculum.

The six main logic gates

NOT gate (inverter)

One input, one output. The output is always the opposite of the input.

Input A | Output (NOT A)
0 | 1
1 | 0

Symbol: a triangle with a small circle (bubble) at the output. Boolean expression: X = NOT A or X = Ā

AND gate

Two inputs, one output. Output is 1 only if both inputs are 1.

Input A | Input B | Output (A AND B)
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1

Symbol: a flat-backed shape with a curved front. Boolean expression: X = A AND B or X = A · B

OR gate

Two inputs, one output. Output is 1 if at least one input is 1.

Input A | Input B | Output (A OR B)
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 1

Symbol: a curved shape with a curved back and pointed front. Boolean expression: X = A OR B or X = A + B

NAND gate

NOT AND — the inverse of AND. Output is 0 only if both inputs are 1.

Input A | Input B | Output (A NAND B)
0 | 0 | 1
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0

NOR gate

NOT OR — the inverse of OR. Output is 1 only if both inputs are 0.

Input A | Input B | Output (A NOR B)
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 0

XOR gate (Exclusive OR)

Output is 1 if the inputs are different from each other.

Input A | Input B | Output (A XOR B)
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0

XOR is particularly useful in binary addition circuits (the half-adder uses XOR + AND).

How to trace a logic circuit with multiple gates

Circuit: A = 1, B = 0, C = 1. Gates: P = A AND B, Q = NOT C, Output = P OR Q

Work through one gate at a time:

Gate | Calculation | Result
P = A AND B | 1 AND 0 | 0
Q = NOT C | NOT 1 | 0
Output = P OR Q | 0 OR 0 | 0

Repeat for A = 1, B = 1, C = 0:

Gate | Calculation | Result
P = A AND B | 1 AND 1 | 1
Q = NOT C | NOT 0 | 1
Output = P OR Q | 1 OR 1 | 1

Always label intermediate outputs (P, Q, etc.) when tracing multi-gate circuits. This prevents errors and shows examiners your working.

Why are NAND and NOR called universal gates?

NAND alone — or NOR alone — can be combined to reproduce any other gate. This means all digital circuits can theoretically be built from only NAND gates (or only NOR gates), which simplifies chip manufacturing. For example:

NOT from NAND: Connect both inputs of a NAND gate to the same signal → output = NOT of that signal.

AND from NAND: NAND followed by NOT (another NAND with both inputs tied).

Real processors are not built this way in practice, but the universality of NAND is an important theoretical concept examined at GCSE.

How does a half-adder work?

A half-adder adds two single bits and produces a sum bit and a carry bit:

A | B | Sum (A XOR B) | Carry (A AND B)
0 | 0 | 0 | 0
0 | 1 | 1 | 0
1 | 0 | 1 | 0
1 | 1 | 0 | 1

When A = 1 and B = 1, 1 + 1 = 2 in decimal = 10 in binary: sum bit = 0, carry bit = 1. This is exactly the output the half-adder produces. Full adders chain half-adders to add multi-bit numbers — and chains of full adders form the ALU in every CPU.

Frequently asked questions

How do I remember which gate is which?

A helpful memory trick: AND needs all inputs to be 1 (think: All AND). OR needs at least one (think: One OR more). NOT is simply the opposite. For XOR: think "eXclusively different" — it outputs 1 when the inputs are not the same. For the inverted gates (NAND, NOR), flip the standard gate's output entirely.

Do I need to know Boolean algebra for GCSE?

AQA and OCR both require students to write and simplify Boolean expressions and to construct truth tables from expressions. The basic operators are AND (·), OR (+), and NOT (overbar or NOT). Simple simplification using laws such as A AND 1 = A or A OR 0 = A may be examined. Full De Morgan's theorem simplification is not required at GCSE but may appear at A-level computing.

What is the difference between a logic gate and a transistor?

A transistor is a physical semiconductor component that acts as an electronically controlled switch. A logic gate is typically built from two or more transistors wired together to implement AND, OR, NOT, or another logical function. A modern CPU contains billions of transistors, each forming part of the logic gates that execute instructions. The logic gate is the logical abstraction; the transistor is the physical implementation.

Why does XOR output 0 when both inputs are 1?

XOR stands for "exclusive or" — it outputs 1 when the inputs are different, and 0 when they are the same. When both inputs are 1, they are the same (both high), so the output is 0. This distinguishes XOR from OR, which outputs 1 whenever at least one input is 1 (including when both are 1). In binary addition, 1 + 1 = 10 (binary): the XOR gives the sum bit (0) and the AND gives the carry bit (1), which is exactly right.

For Socratic GCSE Computer Science tutoring on logic gates, Boolean algebra, and computer architecture, visit aitutors.me.