IGCSE Computer Science - Boolean Logic | Gates, Truth Tables, Circuits, Simulator
Chapter 10 · Paper 2

Boolean Logic

Logic gates, truth tables, logic expressions, circuits, interconversion and an interactive gate simulator.

Based on Cambridge IGCSE / O-Level CS Syllabus 0478/2210 (2026–2028)

1 Introduction to Boolean Logic

Boolean logic is a system of logic where every value is either TRUE (1) or FALSE (0). Logic gates are electronic components that take binary inputs and produce a binary output according to a specific rule.

In truth tables: 1 = TRUE and 0 = FALSE. These two notations are fully interchangeable — you will see both in Cambridge exams.

2 The Six Logic Gates

NOT
AND
OR
NAND
NOR
XOR / EOR
GateRule (plain English)Output = 1 when…
NOTInverts the single inputANDOutput 1 only if BOTH inputs are 1OROutput 1 if AT LEAST ONE input is 1
NANDOpposite of ANDNOROpposite of ORXOR / EOROutput 1 only if inputs are DIFFERENT

3 Truth Tables

NOT Gate (1 input)

ANOT A
01

AND Gate

ABA AND B
0011

OR Gate

ABA OR B
0011

NAND Gate

ABA NAND B
0011

NOR Gate

ABA NOR B
0011

XOR / EOR Gate

ABA XOR B
0011

Memory trick for XOR: "Exclusively different" — output is 1 only when the two inputs are NOT equal to each other.

4 Logic Expressions

A logic expression combines inputs using gate names to describe a circuit in text form. Example: X = (A AND B) OR (NOT C)

Evaluating an Expression — Worked Example

Evaluate X = (A AND B) OR (NOT C) for A=1, B=0, C=1:

  • Evaluate innermost brackets first: A AND B = 1 AND 0 = 0
  • Evaluate NOT: NOT C = NOT 1 = 0
  • Combine with OR: 0 OR 0 = 0
  • Therefore X = 0

5 Logic Circuits

A logic circuit is a diagram of interconnected gate symbols. For this syllabus, circuits have a maximum of three inputs and one output. No simplification is required.

Drawing a Circuit from an Expression

Expression: Z = (A OR B) AND (NOT A)

  • Identify gates needed: 1× OR, 1× NOT, 1× AND
  • Input A feeds into both the OR gate and the NOT gate
  • Input B feeds into the OR gate
  • Output of OR gate and output of NOT gate both feed into the AND gate
  • AND gate output is labelled Z

Always label your inputs (A, B, C) and your final output clearly. Unlabelled inputs or outputs will lose marks in the exam.

6 Three-Input Circuits

With three inputs A, B, C there are 2³ = 8 rows in the truth table. Use this template — the bit pattern is systematic:

ABCOutput
00001111

Pattern: column A alternates every 4 rows, column B every 2 rows, column C every row. This guarantees all 8 combinations are covered systematically.

Worked Three-Input Example

Expression: W = (A AND B) OR (NOT C)

ABCA AND BNOT CW
00001111

7 Interconversion — the 3-Way Skill

The exam can ask you to convert between any combination of these four forms:

Logic Expression
  • Written formula using AND, OR, NOT, NAND, NOR, XOR
  • e.g. X = (A AND B) OR C
  • Use brackets to show order clearly
Truth Table
  • Lists all possible input combinations
  • 2 inputs → 4 rows; 3 inputs → 8 rows
  • One output column filled for every row
Logic Circuit
  • Diagram using standard gate symbols
  • Inputs labelled A, B, C; output labelled
  • Wires connect gate outputs to next gate inputs
Problem Statement
  • Written English description of the logic
  • "Output is 1 when A is 1 and B is 0"
  • Convert words → logic expression → circuit

Practise all directions: expression→circuit, circuit→truth table, truth table→expression, statement→all three. Any direction can appear in the exam — they carry equal weight.

8 Interactive Gate Simulator

Toggle inputs A and B to see all gate outputs update in real time.

🔌 Two-Input Gate Simulator

A = B =
AND: 0
OR: 0
NAND: 1
NOR: 1
XOR: 0

🔌 NOT Gate Simulator

A = NOT A = 1

Stop wrestling with confusion.

Join thousands of students mastering Computer Science without the academic jargon.

From syntax to systems. We break down the hardest ideas in computer science so you can actually build things.

© 2026 Painless Programming. Built for students.
Scroll to Top