How are logical decisions built from gates, and how do we simplify Boolean expressions?
Construct and interpret logic gates and truth tables, write Boolean expressions, and simplify them using Boolean algebra laws
A focused answer to the H2 Computing outcome on digital logic. The AND, OR, NOT, NAND, NOR and XOR gates, building and reading truth tables, writing Boolean expressions, and simplifying them with Boolean algebra laws and De Morgan.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
SEAB wants you to construct and interpret logic gates and truth tables, write Boolean expressions, and simplify them using Boolean algebra. The central idea is that all digital computation is built from a few simple gates, that a truth table fully specifies a circuit's behaviour, and that Boolean algebra lets you reduce an expression to fewer gates.
The answer
The logic gates
A logic gate outputs a 1 or 0 from its binary inputs. The core gates:
| Gate | Symbol in expressions | Output is 1 when |
|---|---|---|
| AND | both inputs are 1 | |
| OR | at least one input is 1 | |
| NOT | the input is 0 (it inverts) | |
| NAND | NOT of AND | |
| NOR | NOT of OR | |
| XOR | the inputs differ |
Truth tables
A truth table lists the output for every input combination. With inputs there are rows, since each input is independently 0 or 1:
| A | B | A AND B | A OR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
The truth table completely defines what a circuit does.
Boolean expressions
A Boolean expression describes a circuit algebraically, for example . Build it by combining the gate operations; evaluate it row by row to get its truth table.
Boolean algebra laws
Boolean algebra lets you simplify expressions to use fewer gates (cheaper, faster circuits). Key laws:
- Identity: , .
- Null: , .
- Idempotent: , .
- Complement: , .
- De Morgan's laws: and .
Universal gates
NAND (and NOR) is a universal gate: every other gate, and therefore any circuit, can be built from NAND alone. This matters in manufacturing - a chip can be made from one repeated gate type.
Examples in context
Example 1. Building an adder. A half-adder that adds two bits uses an XOR gate for the sum and an AND gate for the carry. Chaining full-adders (made from these gates) builds the multi-bit adder inside the ALU, so the arithmetic you do in two's complement ultimately runs on a handful of logic gates.
Example 2. Simplifying to cut cost. A circuit designer reduces a control expression with Boolean algebra before fabrication, because each removed gate saves silicon area, power and propagation delay. De Morgan's laws also let a designer rebuild a circuit using only NAND gates, exploiting NAND's universality for cheaper manufacturing.
Try this
Q1. How many rows does a truth table with four inputs have, and why? [2 marks]
- Cue. rows, because each of the four inputs is independently 0 or 1.
Q2. State De Morgan's law for the negation of an AND. [1 mark]
- Cue. .
Q3. Why is NAND called a universal gate? [2 marks]
- Cue. Every other gate, and hence any circuit, can be constructed from NAND gates alone, so a chip can be made from one repeated gate type.
Exam-style practice questions
Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Original6 marks(a) Write the truth table for the Boolean expression . (b) State how many rows a truth table for three inputs has and why.Show worked answer →
(a) Evaluate (AND), then OR it with (NOT C):
| A | B | C | A AND B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
(b) Three inputs give rows, because each input is independently 0 or 1, and there are combinations.
Markers reward the correctly evaluated intermediate columns and Q, and rows with the reason that each of three inputs has two possible values.
Original5 marks(a) State De Morgan's two laws in Boolean algebra. (b) Simplify the expression using De Morgan's law and state the single gate it is equivalent to. (c) Why is the NAND gate called a universal gate?Show worked answer →
(a) De Morgan's laws:
In words: the negation of an AND is the OR of the negations, and the negation of an OR is the AND of the negations.
(b) Apply De Morgan to : this equals . So the expression simplifies to , which is a single AND gate.
(c) NAND is universal because every other gate (NOT, AND, OR, and hence any circuit) can be built from NAND gates alone. This is valuable because a chip can be manufactured from one repeated gate type. (NOR is universal too.)
Markers reward both De Morgan laws, the simplification to (an AND gate), and NAND universality (any function buildable from NAND alone).
Related dot points
- Describe the components of the CPU - control unit, ALU, registers - and the buses connecting it to memory in the von Neumann architecture
A focused answer to the H2 Computing outcome on CPU components. The control unit, arithmetic logic unit and registers, the address, data and control buses, and the stored-program von Neumann architecture.
- Describe the fetch-decode-execute cycle, the registers involved, and how the program counter sequences instructions
A focused answer to the H2 Computing outcome on the fetch-execute cycle. The fetch, decode and execute stages, the program counter, memory address and data registers, the instruction register, and how branching changes the flow.
- Apply bitwise AND, OR, XOR, NOT and shift operations, and use masks to set, clear, toggle and test individual bits
A focused answer to the H2 Computing outcome on bitwise operations. The AND, OR, XOR and NOT operators, left and right shifts, and using masks to set, clear, toggle and test individual bits.
- Describe the memory hierarchy from registers to secondary storage, and explain how caching exploits locality of reference
A focused answer to the H2 Computing outcome on the memory hierarchy. Registers, cache, main memory (RAM) and secondary storage, the trade-off between speed, cost and capacity, and how caching uses locality of reference.
- Represent signed integers using two's complement, convert to and from denary, and perform subtraction by addition, explaining range and overflow
A focused answer to the H2 Computing outcome on signed integers. Two's complement encoding, converting to and from denary, subtraction as addition, the representable range, and detecting signed overflow.