← 💻 Computer Science

Cambridge IGCSE 0478 · Topic 10 of 10

Boolean logic

The six logic gates, truth tables, logic expressions and building logic circuits from problem statements.

📌 Key points

  1. NOT: one input; the output is the opposite of the input.
  2. AND: output is 1 only if both inputs are 1. OR: output is 1 if either input, or both, is 1.
  3. NAND (NOT AND): output is 0 only if both inputs are 1. NOR (NOT OR): output is 1 only if both inputs are 0.
  4. XOR (exclusive OR): output is 1 only if the inputs are different.
  5. A truth table shows the output for every possible combination of inputs: 2 inputs give 4 rows and 3 inputs give 8 rows (2n rows).
  6. A logic expression describes a circuit using the gate names, e.g. X = (A AND B) OR (NOT C); work out brackets first.
  7. To build a circuit from a problem statement, turn each condition into an input (1 = true), then link them with AND, OR and NOT exactly as the statement says.
  8. In a truth table, add working columns for the part-way results (e.g. A AND B) before working out the final output X.

📖 Key terms

Logic gate
An electronic component that carries out a Boolean operation on one or more inputs to give one output.
Truth table
A table showing the output of a logic circuit for every combination of inputs.
Logic expression
A way of writing a logic circuit using AND, OR, NOT, NAND, NOR and XOR.
NAND
A gate whose output is 0 only when both inputs are 1.
NOR
A gate whose output is 1 only when both inputs are 0.
XOR
A gate whose output is 1 only when the inputs are different.

✏️ Worked example

Find the output of X = (A AND B) OR (NOT C) for every row of the truth table where A = 1.

  1. Rows with A = 1 are: B, C = 0 0, 0 1, 1 0, 1 1.
  2. A AND B is 1 only when B = 1, so the working column is 0, 0, 1, 1.
  3. NOT C is 1 when C = 0, so the working column is 1, 0, 1, 0.
  4. OR the two columns: 0 OR 1 = 1, 0 OR 0 = 0, 1 OR 1 = 1, 1 OR 0 = 1.
  5. So X = 1, 0, 1, 1 for A B C = 100, 101, 110, 111.
💡 Exam tip

Always write truth table inputs in binary counting order (000, 001, 010 … 111) and add working columns. Drawing gates: use the correct shape for each gate, because a wrong shape loses the mark even if the logic is right.

Test yourself8 questions from a bank of 15. A new mix every time.
Start the quiz →

It’s bedtime! 😴

It’s late, and even Numo is getting sleepy. The best thing you can do for your learning now is… go to sleep!

✨ Sleep helps you

  • 🧠 remember what you learned today: your brain saves it while you sleep
  • 🌱 grow and stay healthy
  • ⚡ wake up with energy, ready to learn and play
  • 😊 feel happy and calm

🦉 Going to bed late can make you

  • 😩 tired and sleepy at school tomorrow
  • 🤯 find it harder to focus and to remember
  • 😠 grumpy and easily upset
  • 🤧 catch colds more easily

Children your age need 9 to 12 hours of sleep every night. Numo will be right here tomorrow!