← IGCSE Computer Science · Cambridge · GCSE Computer Science revision
⭐ 0
Cambridge IGCSE Computer Science (0478/0984) · Topic 10 Boolean logic
Mini-Lesson

Boolean logic

3 missions. Guess, learn, then check. Your place is saved.

  1. Mission 1"Tea or coffee?" Would a computer's OR let you have both?
  2. Mission 2Three sensors, one alarm: how many cases must you test?
  3. Mission 3NAND flash is named after a logic gate. What does that gate do?
Mission 1

"Tea or coffee?" Would a computer's OR let you have both?

Make a guess: "Tea or coffee?" Would a computer's OR let you have both?

Boolean logic · AND, OR, NOT

1 or 0, and NOT

NOTANOT A0110
  • A Boolean value has only two states: 1 (TRUE) or 0 (FALSE).
  • A truth table lists every possible combination of inputs with the output for each.
  • NOT has one input and reverses it: NOT 0 = 1, NOT 1 = 0.
  • Write it as NOT A.
Boolean logic · AND, OR, NOT

AND

Truth tablesABA AND B000010100111ANDABA OR B000011101111OR
  • AND has two inputs. The output is 1 only when both inputs are 1.
  • If either input is 0, the output is 0.
  • Write it as A AND B.
ABA AND B
000
010
100
111
Boolean logic · AND, OR, NOT

OR

Truth tablesABA AND B000010100111ANDABA OR B000011101111OR
  • OR has two inputs. The output is 1 when at least one input is 1.
  • The output is 0 only when both inputs are 0.
  • This is wider than everyday "or", which often means "one or the other, not both".
  • Write it as A OR B.
ABA OR B
000
011
101
111
Your answer
?A = 1 and B = 0. Work out NOT A, then A AND B, then A OR B. Type the three output bits in that order.
Boolean logic · AND, OR, NOT

XOR

Truth tablesABA AND B000010100111ANDABA OR B000011101111OR
  • XOR (exclusive OR) has two inputs. The output is 1 when the inputs are different.
  • If both inputs are the same (both 0 or both 1), the output is 0.
  • Cambridge also calls it EOR.
  • Write it as A XOR B.
ABA XOR B
000
011
101
110
Quick check
?A hall light has a switch at each end. Flipping either switch changes the light, whatever the other switch is set to. Which operator gives this behaviour?
Boolean logic · AND, OR, NOT

Logic gate symbols

Logic gate symbolsANDABQABQ000010100111ORABQABQ000011101111NOTAQAQ0110XORABQABQ000011101110
  • A logic gate is a circuit that carries out one logical operator.
  • AND: flat back, rounded front, two inputs.
  • OR: curved back, pointed front, two inputs.
  • NOT: a triangle with a small circle at the output. The circle means "reverse".
  • XOR: the OR shape with an extra curved line behind the inputs.
  • Inputs enter on the left; the output leaves on the right.
Quick check
?A cash machine gives out money only if the card is valid (V) and the PIN is correct (P). Which logic statement matches?
Mission check

?"Tea or coffee?" A customer ticks both, so Tea = 1 and Coffee = 1. What does Tea OR Coffee give?
Mission 2

Three sensors, one alarm: how many cases must you test?

Make a guess: Three sensors, one alarm: how many cases must you test?

Boolean logic · combining operators

Combining operators

  • One logic statement (expression) can use several operators, e.g. (A AND B) OR NOT C.
  • Work out brackets first.
  • NOT applies only to the input or bracket just after it.
  • Example: (1 AND 0) OR (1 AND 1) = 0 OR 1 = 1
  • XOR combines in the same way: NOT (1 XOR 0) = NOT 1 = 0
Boolean logic · combining operators

Every combination of three inputs

Counting the rows1 inputA012 rows×22 inputsAB000110114 rows×23 inputsABC0000010100111001011101118 rows
  • Each input can be 0 or 1, so each new input doubles the number of rows.
  • 1 input: 2 rows. 2 inputs: 4 rows. 3 inputs: 8 rows.
  • Fill the input columns by counting up in binary from 000 to 111. Then no row is missed or repeated.
  • Exam questions use up to three inputs.
Boolean logic · combining operators

Working columns

Working columnsABCA AND BNOT CP000011001000010011011000100011101000110111111101
  • For a long statement, add a column for each part.
  • Example: P = (A AND B) OR NOT C.
  • Column 4: A AND B. Column 5: NOT C. Column 6: P = column 4 OR column 5.
  • Working columns are optional, but they stop you mixing up steps.
ABCA AND BNOT CP
000011
001000
010011
011000
100011
101000
110111
111101
Your answer
?Q = (A OR B) AND NOT C. Complete the output column for the rows 000, 001, 010, 011, 100, 101, 110, 111 (in that order). Type the 8 bits.
Boolean logic · combining operators

From a problem to a logic statement

  • Give each condition a letter (1 = true, 0 = false).
  • "and" → AND; "or" / "either" → OR; "not" / "is off" → NOT.
  • Use brackets to group conditions that go together.
  • Example: the alarm X sounds if the door is open (D) and the system is armed (S), or if the panic button (P) is pressed.
  • X = (D AND S) OR P
Quick check
?A greenhouse sprinkler W switches on when the soil is dry (D) and it is not raining (R), or when the manual override (M) is pressed. Which logic statement matches?
Boolean logic · combining operators

Logic circuits

Alarm circuitANDD AND SORDSPX
  • A logic circuit joins gates with wires, inputs on the left. Each gate's output feeds the next gate.
  • To write the expression, work from the inputs to the output, one gate at a time.
  • The alarm X = (D AND S) OR P is an AND gate (inputs D, S) feeding an OR gate with P.
  • Draw the statement as given, without simplifying. Every gate except NOT has two inputs.
Quick check
?Look at the circuit in the diagram. Which logic statement does it represent?
Which expression?ABCQ
Mission check

?Three sensors, one alarm. How many different input combinations must the truth table cover?
Mission 3

NAND flash is named after a logic gate. What does that gate do?

Make a guess: NAND flash is named after a logic gate. What does that gate do?

Boolean logic · NAND and NOR

NAND

NAND and NORAND and NANDABQABQANDNANDbubble = NOTABA ANDBANANDB0001010110011110OR and NORABQABQORNORbubble = NOTABA OR BA NORB0001011010101110
  • NAND means NOT AND: an AND gate followed by NOT.
  • The output is 0 only when both inputs are 1. Otherwise it is 1.
  • Symbol: the AND shape with a small circle (bubble) on the output.
  • Write it as A NAND B, which equals NOT (A AND B).
ABA AND BA NAND B
0001
0101
1001
1110
Boolean logic · NAND and NOR

NOR

NAND and NORAND and NANDABQABQANDNANDbubble = NOTABA ANDBANANDB0001010110011110OR and NORABQABQORNORbubble = NOTABA OR BA NORB0001011010101110
  • NOR means NOT OR: an OR gate followed by NOT.
  • The output is 1 only when both inputs are 0. Otherwise it is 0.
  • Symbol: the OR shape with a small circle on the output.
  • Write it as A NOR B, which equals NOT (A OR B).
ABA OR BA NOR B
0001
0110
1010
1110
Quick check
?A gate's output column, for inputs 00, 01, 10, 11, is 1, 0, 0, 0. Which gate is it?
Boolean logic · NAND and NOR

All six gates side by side

All six gatesNOTAQAQ0110XORABQABQ000011101110ANDABQABQ000010100111NANDABQABQ001011101110ORABQABQ000011101111NORABQABQ001010100110
  • A bubble on the output reverses the column: NAND is AND reversed, NOR is OR reversed.
  • AND 0001 · NAND 1110 · OR 0111 · NOR 1000 · XOR 0110 (inputs 00, 01, 10, 11).
  • NOT is the only gate with one input. All the others have exactly two.
  • To spot a gate from its column, count the 1s and see which rows they are on.
Your answer
?X = (A NAND B) NOR C. Complete the output column for the rows 000, 001, 010, 011, 100, 101, 110, 111 (in that order). Type the 8 bits.
Boolean logic · NAND and NOR

From a truth table to an expression

  • Find each row where the output is 1.
  • For each such row, AND the inputs, with NOT on any input that is 0.
  • Join the row terms with OR.
  • Example: X = 1 on rows 01 and 10 gives X = (NOT A AND B) OR (A AND NOT B). That is XOR.
  • For a circuit, draw one 2-input gate per operator, without simplifying.
Quick check
?A truth table with inputs A, B, C has X = 1 only on rows 001 and 110. Which expression matches it?
Mission check

?NAND flash memory is named after the NAND gate. What does a NAND gate do?
Recap

Big ideas

  • Every input and output is 1 (TRUE) or 0 (FALSE). A truth table lists every combination of inputs.
  • AND: 1 only if both inputs are 1. OR: 1 if at least one input is 1. NOT: reverses its one input.
  • XOR: 1 only when the two inputs are different.
  • Work out brackets first; NOT applies only to what comes straight after it.
  • 3 inputs give 8 rows: count in binary from 000 to 111, and add working columns for each part.
  • Turn a problem into a statement by giving each condition a letter and mapping "and", "or", "not".
  • In a circuit, each gate's output feeds the next gate; read it from inputs to output.
  • NAND = NOT AND (column 1110). NOR = NOT OR (column 1000). The bubble means NOT.
  • To write an expression from a truth table, AND the inputs for each row that outputs 1, then OR the row terms together.
🏆

Mini-lesson complete!

⭐⭐⭐

You've worked through Boolean logic for Cambridge IGCSE Computer Science (0478/0984). 🎉

  1. Mission 1"Tea or coffee?" Would a computer's OR let you have both?
  2. Mission 2Three sensors, one alarm: how many cases must you test?
  3. Mission 3NAND flash is named after a logic gate. What does that gate do?

Your stars: 0 / 0

Next: test yourself in the Verify stage.

📣 Smashed it? Share your score

Challenge a mate to beat your stars, or show a parent how you got on.

→ Back to IGCSE Computer Science · Cambridge

Specification points and sources for this lesson are listed at the bottom of the page.

Sources (5)

The specification points and sources behind this lesson.

  1. 1 Cambridge IGCSE 0478 syllabus 2026–2028, 10.1–10.2 and logic gate symbols (section 4)
  2. 2 Cambridge IGCSE 0478 syllabus 2026–2028, 10.3
  3. 3 Cambridge IGCSE 0478 syllabus 2026–2028, 3.2 secondary storage notes ("Solid-state (flash memory) uses NAND or NOR technology")
  4. 4 Cambridge IGCSE 0478 syllabus 2026–2028, 10.1–10.3 and section 4 "Logic gate symbols"
  5. 5 TechTarget, "Choose between NAND vs NOR flash memory", https://www.techtarget.com/searchstorage/feature/Choose-between-NAND-vs-NOR-flash-memory