What Boolean logic is and why it matters

Every decision a computer makes reduces to a question with two possible answers: true or false, 1 or 0. Boolean logic is the formal system that governs how these binary values combine. In the Cambridge IGCSE Computer Science syllabus (0478), Boolean logic appears in the section on logic gates and logic circuits. You need to know six gates, read and construct truth tables, write and interpret logic expressions, and trace signals through multi-gate circuits. This topic is one of the most predictable on the exam: the question formats repeat, the gate set is fixed, and accuracy is rewarded over speed.

The six logic gates

The IGCSE syllabus requires you to know six logic gates. Each gate takes one or two binary inputs and produces a single binary output according to a fixed rule. The table below gives the gate name, its logic rule, the written expression, and the full truth table.

AND gate

The AND gate outputs 1 only when all inputs are 1. If either input is 0, the output is 0. Think of it as both conditions must be true.

Expression: X = A AND B (also written as X = A . B)

ABX = A AND B
000
010
100
111

OR gate

The OR gate outputs 1 when any input is 1. The output is 0 only when both inputs are 0. Think of it as at least one condition must be true.

Expression: X = A OR B (also written as X = A + B)

ABX = A OR B
000
011
101
111

NOT gate

The NOT gate has a single input and inverts it. A 1 becomes 0, and a 0 becomes 1. It is the simplest gate.

Expression: X = NOT A

AX = NOT A
01
10

NAND gate

NAND stands for NOT AND. It produces the exact opposite output of an AND gate. The output is 0 only when both inputs are 1. In every other case, the output is 1.

Expression: X = NOT (A AND B)

ABX = NOT (A AND B)
001
011
101
110

NOR gate

NOR stands for NOT OR. It produces the exact opposite output of an OR gate. The output is 1 only when both inputs are 0.

Expression: X = NOT (A OR B)

ABX = NOT (A OR B)
001
010
100
110

XOR gate (Exclusive OR)

The XOR gate outputs 1 when the inputs are different. If both inputs are the same (both 0 or both 1), the output is 0. The name "exclusive" is the clue: it excludes the case where both inputs match.

Expression: X = A XOR B

ABX = A XOR B
000
011
101
110
Exam tip: The fastest way to remember the NAND and NOR truth tables is to write out the AND or OR table first, then flip every output. This is quicker and less error-prone than memorising two separate tables.

Quick-reference comparison

The following table puts all six gates side by side. The output column shows the result for each of the four standard two-input combinations (00, 01, 10, 11). NOT is listed with its two single-input results.

GateRuleOutputs (00, 01, 10, 11)
ANDBoth inputs must be 10, 0, 0, 1
ORAt least one input must be 10, 1, 1, 1
NOTInverts the input1, 0
NANDOpposite of AND1, 1, 1, 0
NOROpposite of OR1, 0, 0, 0
XORInputs must be different0, 1, 1, 0

Building truth tables

A truth table lists every possible combination of inputs and the resulting output. The method is systematic.

Step 1: Count the inputs. With n inputs, the table has 2^n rows. Two inputs give 4 rows. Three inputs give 8 rows.

Step 2: List all input combinations. Use binary counting. For two inputs A and B: 00, 01, 10, 11. For three inputs A, B, C: 000, 001, 010, 011, 100, 101, 110, 111. A useful pattern: the rightmost column alternates 0, 1, 0, 1. The next column alternates in pairs: 0, 0, 1, 1. The next alternates in fours: 0, 0, 0, 0, 1, 1, 1, 1.

Step 3: Evaluate the expression column by column. If the expression has intermediate steps (for example, NOT A fed into an AND gate with B), add intermediate columns. Work left to right through the expression, filling each column before moving to the next.

Example: Build the truth table for X = (NOT A) AND B.

Step 1: Two inputs (A, B), so 4 rows.
Step 2: List combinations: 00, 01, 10, 11.
Step 3: Add an intermediate column for NOT A, then evaluate (NOT A) AND B.
ABNOT AX = (NOT A) AND B
0010
0111
1000
1100

The output is 1 only when A is 0 and B is 1. That result makes sense: NOT A requires A to be 0, and the AND gate then requires B to be 1.

Logic expressions and notation

Cambridge uses a specific notation for logic expressions in the IGCSE 0478 paper.

OperationWritten formSymbol form
ANDA AND BA . B
ORA OR BA + B
NOTNOT AA with overline (or NOT A)

Be careful with the dot and plus symbols. In Boolean logic, the dot (.) means AND and the plus (+) means OR. These are not multiplication and addition in the arithmetic sense, even though the symbols look identical.

Writing an expression from a circuit: Start at the inputs and follow the signal through each gate. Label the output of each intermediate gate, then combine the labels into the final expression. Brackets show which operation happens first.

Writing an expression from a truth table: Look at every row where the output is 1. For each such row, write a term that describes the input combination (using AND for the inputs that are 1 and NOT for inputs that are 0). Connect the terms with OR. This produces a sum-of-products expression.

Combining gates into circuits

Real logic problems use multiple gates connected in sequence. To trace through a multi-gate circuit, work from the inputs toward the output, evaluating one gate at a time.

Worked example: alarm system

A building has an alarm system with three binary inputs:

  • D = door sensor (1 = door open, 0 = door closed)
  • W = window sensor (1 = window open, 0 = window closed)
  • A = alarm armed (1 = armed, 0 = disarmed)

The alarm should sound (output X = 1) when the alarm is armed AND either the door or the window is open.

Expression: X = (D OR W) AND A

The circuit uses two gates. First, an OR gate takes D and W as inputs. Its output feeds into an AND gate alongside A. Trace the truth table for all eight input combinations:

DWAD OR WX = (D OR W) AND A
00000
00100
01010
01111
10010
10111
11010
11111

The alarm sounds in exactly three situations: door open with alarm armed, window open with alarm armed, or both open with alarm armed. The circuit behaves exactly as intended.

Worked exam-style questions

Question 1: Complete the truth table

A logic circuit has two inputs, P and Q, and one output, X. The expression for the circuit is:

X = (P AND Q) OR (NOT P)

Complete the truth table for this circuit. [4 marks]

Solution: Add intermediate columns for P AND Q and NOT P. Then combine them with OR.

When P=0, Q=0: P AND Q = 0, NOT P = 1, so X = 0 OR 1 = 1
When P=0, Q=1: P AND Q = 0, NOT P = 1, so X = 0 OR 1 = 1
When P=1, Q=0: P AND Q = 0, NOT P = 0, so X = 0 OR 0 = 0
When P=1, Q=1: P AND Q = 1, NOT P = 0, so X = 1 OR 0 = 1
PQP AND QNOT PX
00011
01011
10000
11101

Question 2: Write the expression from a circuit description

A logic circuit has three inputs: A, B, and C. The circuit works as follows:

  • Gate 1 is a NAND gate with inputs A and B. Its output is called T.
  • Gate 2 is an OR gate with inputs T and C. Its output is X.

Write the Boolean expression for X. [2 marks]

Solution:
Gate 1: T = NOT (A AND B)
Gate 2: X = T OR C

Substitute T into the second expression:
X = NOT (A AND B) OR C

The key technique is labelling each gate's output, then substituting back to get the final expression. This same method works for circuits with any number of gates.

Common mistakes

  1. Confusing OR with XOR. Standard OR outputs 1 when both inputs are 1. XOR outputs 0 in that case. If you find yourself writing "one or the other but not both," that is XOR, not OR.
  2. Forgetting NOT inverts only one input. In a circuit, NOT applies to whichever signal it is connected to. If NOT sits before an AND gate on only the A input, it inverts A but leaves B unchanged.
  3. Missing rows in truth tables. Two inputs require exactly 4 rows. Three inputs require exactly 8 rows. Missing even one row loses marks.
  4. Dropping brackets in expressions. X = NOT A AND B is ambiguous. X = (NOT A) AND B is clear: NOT applies to A only. X = NOT (A AND B) is also clear: the AND is evaluated first, then the result is inverted. Missing brackets is one of the most frequent sources of lost marks on this topic.
  5. Confusing the dot and plus notation. The dot (.) means AND. The plus (+) means OR. Students who mix these up produce entirely wrong truth tables.
Exam tip: When tracing a circuit, write intermediate values above each wire. This prevents errors from cascading through the circuit. If you make a mistake at the first gate but have shown your working, you may still earn method marks for the remaining gates.

Translating real-world problems into logic

The IGCSE exam often frames Boolean logic in a real-world context. A question might describe a car that starts only when the seatbelt is fastened AND the key is turned, or a vending machine that dispenses only when the correct amount is inserted OR a token is used.

The approach is consistent:

  1. Identify the binary inputs (what conditions are being checked).
  2. Identify the output (what happens when the conditions are met).
  3. Determine the relationship: does every condition need to be true (AND), or just one (OR)? Is any condition inverted (NOT)?
  4. Write the expression, then draw the truth table to verify it matches the described behaviour.

Practise this translation skill. The gates themselves are simple. The challenge in exam questions is mapping the English description to the correct combination of gates.

Self-check questions

  1. A NAND gate has inputs A = 1 and B = 0. What is the output? Explain your reasoning.
  2. Write the Boolean expression and complete the truth table for a circuit where input A goes through a NOT gate, and the result is fed into an OR gate alongside input B.
  3. A safe opens when a PIN is correct (P = 1) AND a fingerprint matches (F = 1) AND the time lock has expired (NOT T, where T = 1 means the time lock is still active). Write the expression for the output X and list the input combination(s) that open the safe.
  4. How many rows does a truth table need if there are four inputs? Show how you calculated this.
  5. Explain the difference between OR and XOR using the input combination A = 1, B = 1.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Past Papers Across IGCSE, JAMB, WAEC & NECO
Over 3000 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning
TLDR

A thorough guide to Boolean logic for Cambridge IGCSE Computer Science (0478), covering all six logic gates, truth table construction, logic expressions, multi-gate circuits, and worked exam-style questions with common mistakes to avoid.