Algorithms and programming · GCSE Computer Science
Boolean logic
AND, OR and NOT gates, truth tables, and how to read a logic circuit the way the paper draws it.
AND is fussy, OR is generous, NOT flips the world.
The important bits
What you need to know
- 1
Boolean values are TRUE or FALSE, 1 or 0. Logic gates are the hardware (and the algebra) that combine them. Every IF-condition in software is the same idea in another costume.
- 2
NOT has one input and inverts it: 0→1, 1→0. The truth table has two rows. The algebraic mark is a bar over the variable or a ¬.
- 3
AND outputs 1 only if every input is 1. Two-input AND has a 1 in the last row only. Think “both conditions must be true”.
- 4
OR outputs 1 if at least one input is 1. Only 0 OR 0 is 0. (This is inclusive OR, not XOR, unless the paper draws the extra exclusive-or gate.)
- 5
XOR (if your spec includes it) is 1 when the inputs are different. Do not confuse it with OR in a circuit question.
- 6
To fill a truth table for a circuit: list every input combination (2ⁿ rows), then add a column per gate in the order the signals flow. Never jump to the final output in your head on a 4-gate diagram.
- 7
Boolean expressions can be written from a circuit and vice versa. Brackets matter: A AND (B OR C) is not (A AND B) OR C. You can often simplify with the identities (A AND 1 = A, A OR 0 = A, A AND NOT A = 0).
- 8
Typical exam applications: an alarm that sounds if a door is open AND the system is armed; a heating system that runs if time-on OR frost-stat. Translate English into gates, then prove it with a table.
Go deeper
Building a truth table without heroics
Suppose inputs A, B, C and a circuit that computes (A AND B) OR NOT C. There are eight rows from 000 to 111. First column-group: A, B, C in binary counting order so you do not miss a combination. Next column: A AND B. Next: NOT C. Last: OR those two together. If you skip the intermediate columns you will mis-copy a wire. This is the same discipline as a trace table. For 5-mark questions they often give a half-filled table — complete it, then write the expression. If they ask whether two circuits are equivalent, compare output columns; do not argue from how neat the drawing looks.
Go deeper
From English to gates
“The lamp lights if the switch is on and the door is closed, or if the override is pressed.” That is (Switch AND NOT DoorOpen) OR Override — or (Switch AND DoorClosed) OR Override depending on how the sensor is named. The danger word is “or” in English, which sometimes means XOR (“tea or coffee”) and sometimes inclusive OR. In GCSE circuits, OR is inclusive unless they specify XOR. Draw the gates, label the wires, then pick one row of the truth table and walk the 1s through as a check. If a 6-mark question gives a faulty table, find the gate whose output column does not match its inputs — that is the broken component.
See the idea in action
Circuit: two inputs A and B into an AND, that output into a NOT (a NAND in two chips). Truth table: 00→0→1, 01→0→1, 10→0→1, 11→1→0. Expression: NOT (A AND B). Application: a safety relay that is active unless both sensors agree the machine is in danger. The worked answer is the table plus the expression, not a paragraph about “logic being important”.
Exam technique
Turn knowledge into marks
Learn the three gate shapes until you cannot mix them up under time pressure. A correct table on the wrong symbol is still wrong.
Common mistakes
Do not give these marks away
- 01
Mixing up AND and OR output rows.
- 02
Applying NOT to both inputs of a two-input gate when the bubble is only on the output.
- 03
Writing A AND B OR C without brackets, then evaluating it in a different order from the circuit.
When is the output of a two-input AND gate 1?
AWhen at least one input is 1
BWhen both inputs are 1
CWhen both inputs are 0
DWhen the inputs are different
Show the answer
When both inputs are 1. AND is only true when every input is true. OR would be “at least one”; XOR would be “different”. Those three rows are the whole subject’s common mix-up.
Quick questions
If this is the bit you searched
Do I need to learn Boolean algebra laws?
Know the simple identities and that brackets follow the circuit. Heavy simplification is less common than truth tables at GCSE, but A AND NOT A = 0 is a useful check.
Is NAND on the specification?
Some boards expect you to recognise NOT-AND as a universal gate; others stay with AND/OR/NOT/XOR. Draw what is in front of you and build it from the three basics if needed.