Logic Gates & Truth Tables: The Building Blocks of the ALU

How do you quickly fill out the 8 output rows for an XOR (Exclusive OR) gate?
Table of Contents
Logic gates are actual physical microscopic transistors inside the CPU that control the flow of electricity based on boolean logic (True/False or 1/0). In Paper 1, you will routinely be asked to trace the outputs through a complex circuit. This guide from our Ultimate O-Level Computer Science Guide gives you the exact rules.
1. The Core Three (AND, OR, NOT)
Every other piece of logic in the computer is built from these three bases.
- NOT Gate (Inverter): Has only ONE input. It flips the bit. If 1 goes in, 0 comes out. If 0 goes in, 1 comes out. Draws as a triangle with a tiny circle at the tip.
- AND Gate: Takes two inputs. Outputs 1 ONLY IF Input A and Input B are both 1. Otherwise, it outputs 0. Draws as a 'D' shape.
- OR Gate: Takes two inputs. Outputs 1 if AT LEAST ONE of the inputs is 1. It also outputs 1 if both are 1. Draws as a curved shield shape.
2. The Inverted Gates (NAND, NOR, XOR)
When you stick a NOT gate at the end of an AND or OR gate, you get their inverted cousins.
NAND Gate (NOT-AND)
It does the exact opposite of an AND gate. It outputs a 0 ONLY when both inputs are 1. In all other scenarios, it outputs a 1.
NOR Gate (NOT-OR)
The exact opposite of an OR gate. It outputs a 1 ONLY when both inputs are 0. If it spots a single '1' anywhere in the inputs, it slams shut and outputs a 0.
XOR Gate (Exclusive-OR)
The "Difference Detector". It outputs a 1 if the inputs are different (e.g., 1 and 0). If the inputs are the same, it outputs 0. It is basically the standard OR gate, but it strictly excludes the "both inputs are 1" scenario.
3. The Intermediary Column Trick for Truth Tables
A logic circuit with 3 inputs (A, B, C) will require you to fill out an 8-row truth table. Many students try to trace the 0s and 1s through the whole circuit in their head, get confused by row 6, and fail the question.
Always use Working Columns!
If a circuit combines (A AND B) into an OR gate with C. Do not do it all at once. Create a blank column in your exam paper with a pencil. Label it 'Z'. Let Z equal the output of (A AND B). Fill out all 8 rows for Z first. Once you have Z, you easily compare the Z column with the C column through the final OR gate to get the final answer. Break the complex circuit into smaller, safe steps.
Frequently Asked Questions
What is the difference between an AND gate and an OR gate?▼
How does an XOR gate work?▼
What does the little circle on a NAND or NOR gate represent?▼
How many rows are in a 3-input truth table?▼
Stop Guessing, Start Scoring
Get instant access to 500+ CAIE-aligned practice questions, worked solutions, and AI-powered mock exams across all O-Level subjects.