Year 12

AQA A level Computer Science [P1] Logic Gates Notes

Logic Gates

— Computer Science · AS Level (9618) —
★ Exam Tip: A very easy, logical chapter — nothing to memorise, only to understand. Every question is one of 5 cases (usually 3–5 marks each) and they are free marks if you practise. Do topical past papers!

1. What are Logic Gates?

Definition: Logic gates are used in digital electronics and are used to create electronic circuits.

  • Gates work on Boolean values = values with only 2 possible states → 0 and 1. Inputs are 0/1 and the output is 0/1.
  • Used to build monitoring & control systems (sensors → logic → actuator). Any circuit you create uses gates.
  • We pick the gate that gives the output we want: e.g. input 0, 0 must give 0 → choose the right gate.
Remember: a gate is NOT a separate physical device (like a transistor, IC or register). We only use the symbols to understand the logic & design circuits easily.

In real life a gate is just wires + breadboard + transistors arranged to do the same processing. (At university, in digital electronics, you even learn how to build AND / OR / NOR from transistors.) It is not software either — wires carry the 0s and 1s.

Logic gate = one single gate.   Logic circuit = a combination of different logic gates joined together.

THAC
AC example: AND ⇒ AC ON only when both sensors read 1
temp sensorhumidity sensorAND gateOR would switch AC on with just ONE sensor ✗
sensors → gate → actuator (AC)
Example (sensors & AC):
AC should turn ON only if both the temperature sensor and the humidity sensor read 1. Both 1 → output 1 ⇒ AND gate. With an OR gate, even one sensor reading 1 would switch the AC on — that is not our scenario.

2. Symbols of Logic Gates

There are 6 types of gates: NOT, OR, AND, NAND, NOR, XOR. Learn to draw every one — relate each symbol to a shape so it sticks.

NOT
OR
AND
NAND
NOR
XOR
Sir's shape tricks:
  • NOT = triangle + circle (bubble)
  • OR = like a little fish (curved back, pointed nose)
  • AND = the letter D
  • NAND = AND + circle  |  NOR = OR + circle
  • XOR = OR + one extra curved line (a "parenthesis") at the back

The lines on the left = number of inputs: NOT has only 1 input; AND, OR, NAND, NOR, XOR each have 2 inputs (called A and B). One output → X.

3. Truth Tables

  • Truth tables are used to trace the output from a logic gate or logic circuit.
  • The NOT gate is the only logic gate with one input.
  • When constructing truth tables, all possible combinations of 1s and 0s are considered.

Link with Paper 2: a truth table is just like a trace table — there you dry-run the code step by step and note every value, then write the final output. Here you trace the values through the gates one by one and note the output. A truth table has two things: input values and output values.

Number of combinations (rows)rows = 2n   (n = number of inputs)
2 inputs: 2² = 4 rows
AB
00
01
10
11
3 inputs: 2³ = 8 rows
ABC
000
001
010
011
100
101
110
111

② Quick trick to fill the input columns (≈ 5 seconds!)

  1. Find rows = 2n (e.g. 3 inputs → 8).
  2. Column A: rows ÷ 2 → that many 0s, then that many 1s (8 ÷ 2 = 4×0, 4×1).
  3. Column B: halve again → 2×0, 2×1, 2×0, 2×1.
  4. Column C: halve again → 1×0, 1×1 repeated. Keep halving until you reach 1.
InputsrowsABCD
242×0, 2×11×0, 1×1 …
384×0, 4×12×0, 2×1 …1×0, 1×1 …
4168×0, 8×14×0, 4×1 …2×0, 2×1 …1×0, 1×1 …
Don't waste time: filling all combinations is Step 1 of every "complete the truth table" question — it must take only a few seconds. A-Levels also test your time management, not just knowledge.

4. The Six Gates in Detail

Two ways to write a gate: Logic notation = in words (X = A AND B)  |  Boolean algebra = in algebra symbols (X = A·B). Like "sum of 1 and 2" (words) vs "1 + 2" (algebra). X is the output variable. Boolean algebra is studied in detail at A2.

① NOT gate — the INVERSE

AX
01
10

Rule: NOT just inverts the input: 0 → 1 and 1 → 0. Easiest word to remember it: INVERSE.

1 input ⇒ 2¹ = 2 rows (only 0 and 1).

X = NOT A  (Logic notation)
X = A  (Boolean algebra)

A bar (dash) over a letter ⇒ a NOT gate is used.

Example:
A = 0 0 0 0 1 1 1 1  ⇒  NOT A (A) = 1 1 1 1 0 0 0 0  (just flip every value).

② OR gate

ABX
000
011
101
111

If even one input is 1, then the output is 1.

Memory link: addition — but do not confuse it with binary addition (here 1 + 1 gives 1).

X = A OR B  (Logic notation)
X = A + B  (Boolean algebra)

Sensor idea:
both sensors 0 → AC stays off. One sensor 1 (either A or B) → output 1 → AC turns ON.

③ AND gate

ABX
000
010
100
111

If even one input is 0, then the output is 0.

Trick: link it to multiplication — anything × 0 = 0. Simply remember: a 0 anywhere ⇒ output 0.

X = A AND B  (Logic notation)
X = A·B  (Boolean algebra)

Sensor idea:
A = 1, B = 0 → AC still OFF. Only when sensor A and sensor B are both 1 does the output become 1. Circuit for X = A AND B = connect inputs A and B to one AND gate and the gate output to X.
Summary: AND → one 0 makes the output 0.   OR → one 1 makes the output 1.

④ NAND gate

ABX
001
011
101
110

Inverse the output of AND.

X = A NAND B  (Logic notation)
X = A·B  (Boolean algebra)

Boolean form = the AND form with a bar over the whole A·B (A·B is treated as one output, then NOT'd).

Sir's trick: don't memorise NAND & NOR! First solve it as AND (in your head / working), then invert every answer.
NAND, step by step:0, 0 → AND gives 0 → invert → 10, 1 → AND gives 0 (a 0 is present) → invert → 11, 0 → AND gives 0 → invert → 11, 1 → AND gives 1 → invert → 0

⑤ NOR gate

ABX
001
010
100
110

Inverse the output of OR.

X = A NOR B  (Logic notation)
X = A + B  (Boolean algebra)

0, 0 → OR gives 0 → write 1.  0, 1 → OR gives 1 → write 0. Same idea: solve as OR, then invert.

⑥ XOR gate (exclusive OR)

ABX
000
011
101
110

Same inputs → output 0.
Different inputs → output 1.

Memory: "same 0, different 1".

X = A XOR B  (Logic notation)
X = A ⊕ B  (Boolean algebra)

⊕ = a plus with a circle — a "+" because XOR comes from OR, hence its other name: exclusive OR.

5. How Questions Come — the 5 Cases

Questions are all alike: "draw a logic circuit, fill a truth table". Sometimes the table is half-filled for you, sometimes you fill it all. Only the starting point changes → we group them into 5 cases:

Problem statementLogic expressionLogic circuitTruth tableCase 5Case 1Case 3Case 2Case 4
which way are you converting?
CaseGivenYou must…
1logic expressionconstruct the logic circuit
2logic circuitconstruct the truth table
3logic circuitwrite the logic expression
4truth tablewrite the logic expressionA2-type
5problem statementconstruct the logic circuithardest-looking
Note: Case 4 (expression from truth table) was added in the 9618 syllabus (not in 9608). It is mostly an A2 idea — it may or may not appear at AS, but the basics are easy so learn them to be safe.

6. Case 1 — Circuit from a Logic Expression

Idea: you know every gate now, so just build the expression piece by piece. Brackets first — exactly like basic algebra / BODMAS: solve the bracket, then use its answer with the rest.

  1. Build the bracket part first (inside gates).
  2. Take that bracket's output and combine it with the remaining variable using the next gate.
  3. Connect the last gate to X. The order of the two inputs of a gate does not matter.
Translating words → gates: NOT C = a NOT gate on input C only.   NOT (A AND B) = NAND (the NOT sits on the answer of the AND).   NOT (… OR …) = NOR.   The "NOT" given outside is only there to confuse you — move it inside as NAND / NOR.
Same as maths: 5 + 2 in a bracket × 6 → solve the bracket first, then multiply by 6. Likewise B AND NOT C is solved first, then its answer is ORed with A.
Q6(a) [5]Case 1 · expression → circuit

Draw a logic circuit for  X = A OR (B AND NOT C)

Bracket first: B AND NOT C → B as it is; NOT gate on C (NOT C); these two go into an AND. That output is then ORed with A → X.

ABCX
3 gates: NOT, AND, OR
Q [4]Case 1 · max four gates

Draw the circuit for  X = NOT (A AND B) OR NOT (NOT B OR C)  using a maximum of four gates.

NOT (A AND B) = A NAND B → 1 gateNOT (NOT B OR C) = NOT B NOR C → NOT + NOR = 2 gatesjoin the two answers with an OR → 1 gatetotal = 4 gates

Why: "NOT of AND" = NAND and "NOT of OR" = NOR, so the outer NOTs are absorbed — that is how you stay within 4 gates. (NAND = AND + NOT would also be correct but uses more gates.)

ABCX
NAND, NOT, NOR, OR
Q6(a) [5]Case 1 · two parts joined

Draw a circuit for  X = A OR (B AND NOT C) OR (A AND B)

Part ① = A OR (B AND NOT C) → exactly the circuit above.
Part ② = (A AND B) → one AND gate.
Finally OR part ① with part ② → X. (Do part ① first or last — like addition, the order does not matter. Treat each part as its own little circuit.)

ABCX
part ① + part ② joined by OR
Q2(a) [4]Case 1 · with XOR

Draw a circuit for  X = NOT (A AND B) AND (C XOR D)

A, B → NAND  |  C, D → XOR  |  both answers → AND → X.

ABCDX
NAND, XOR, AND
Exam Tip: sir did the hardest versions here — real questions are easier. Practise = improve. Sketch roughly in pencil first, then trace over in pen; a ruler/perfect drawing only if you have spare time (the marks are for the correct circuit).

7. Case 2 — Truth Table from a Logic Circuit

You must know each gate's rule (e.g. AND: any 0 → 0). Use the working space given — it makes the question easy.

① write all inputcombinations② name each gateoutput D, E, F…③ fill column bycolumn (gate rules)④ last gatecolumn = X
method for every circuit → truth table
  1. Inputs: write all 2n combinations (halving trick).
  2. Name each gate's output with a letter (D, E, F … any letters) and write them as columns in the working space, with a line between columns.
  3. Solve one gate at a time, left → right. For NAND / NOR: solve as AND / OR in your head, then invert.
  4. The last gate's column is the answer X.
Tally trick: if a gate needs an input (e.g. B) from far away, rewrite B's column right next to it in the working space — then you can tally easily and won't read someone else's 0.
Common mistake: a very childish question, yet one tiny slip ruins the whole answer — reading another row's 0 or 1. Do it slowly and carefully; never solve in your head. Under exam pressure you will make silly mistakes otherwise.
Q8(a) [4]Case 2 · circuit → truth table

Complete the truth table for the logic circuit shown (3 NOR gates + a final OR).

ABCXDEF
D = A NOR B  |  E = B NOR C  |  F = B NOR E  |  X = D OR F
Solving it:D = A NOR B: OR first (0 0 → 0, any 1 → 1) then invert → 1 1 0 0 0 0 0 0E = B NOR C → 1 0 0 0 1 0 0 0F has inputs B and E → write B again next to E, then B NOR E → 0 1 0 0 0 1 0 0X = D OR F → 1 1 0 0 0 1 0 0
Q8(a) — answer table
ABCD
A NOR B
E
B NOR C
B
copy
F
B NOR E
D
copy
X
D OR F
000110011
001100111
010001000
011001000
100010000
101000101
110001000
111001000

X = 1, 1, 0, 0, 0, 1, 0, 0  (4 marks — fill the table, answer matters most)

Q4(a) [4]Case 1 + Case 2 combined

(a) Draw the circuit that directly matches: X = 1 IF (A is NOT 1 OR B is 1) AND (B is 1 OR C is 1). (b) Complete the truth table.

Reading it: "A is NOT 1" → NOT gate on A; "B is 1" → just B. First bracket: NOT A OR B (call it D). Second bracket: B OR C (call it E). The two brackets are ANDed → X.

ABCXDE
(a) NOT, OR, OR, AND — D and E marked for the working
Q4(b) [4]truth table, working columns Ā, D, E
ABCAD
Ā OR B
E
B OR C
X
D AND E
0001100
0011111
0101111
0111111
1000000
1010010
1100111
1110111
Ā = NOT A → 1 1 1 1 0 0 0 0D = Ā OR B → 1 1 1 1 0 0 1 1E = B OR C → 0 1 1 1 0 1 1 1X = D AND E → 0 1 1 1 0 0 1 1
Q(b) [4]Case 2 · expression given, no circuit

Complete the truth table for  X = NOT (A AND B) OR (A AND (B XOR C))

No circuit is given → make your own names: D = A AND B; E = B XOR C; F = A AND E. Put these in the working space and use them. (XOR is always given with brackets.)

Q(b) — working
ABCD
A AND B
D
NOT D
E
B XOR C
F
A AND E
X
D̄ OR F
00001001
00101101
01001101
01101001
10001001
10101111
11010111
11110000
D = A AND B → 0 0 0 0 0 0 1 1D̄ = invert D → 1 1 1 1 1 1 0 0E = B XOR C (different → 1, same → 0) → 0 1 1 0 0 1 1 0F = A AND E → 0 0 0 0 0 1 1 0X = D̄ OR F → 1 1 1 1 1 1 1 0

Tip: if the working space is small, draw a line beside the table and do each AND/OR as "0 and 0 → 0" on paper — don't do it in your head. Marks are given for the answer, not the working — but showing working costs nothing and avoids mistakes.

8. Case 3 — Logic Expression from a Circuit

Brackets are the key! Write one bracket per gate (start from the top / left) and combine the brackets step by step.

There are no fixed steps for this — it all depends on your logic, which gets stronger as you practise Case 1. Also write "NOT A" (NOT first, then the letter), never "A NOT".

Q(c)Case 3 · circuit → expression

Write a logic statement that describes the following logic circuit.

ABCX
note: C splits — one branch to the OR gate, the other through its own NOT gate
Build it gate by gate:top AND gate: NOT A and B → (NOT A AND B)lower OR gate: NOT B and C → (NOT B OR C)the middle OR joins these two brackets → ((NOT A AND B) OR (NOT B OR C))the final AND joins that whole bracket with NOT CX = ((NOT A AND B) OR (NOT B OR C)) AND NOT C
X = ( (NOT A AND B) OR (NOT B OR C) ) AND NOT C

9. Case 4 — Logic Expression from a Truth Table

Note: this is really an A2 concept (simplifying with Boolean algebra comes later — not needed now). But the 9618 syllabus lists it, so learn the basics to be on the safe side. If it does not come, no loss.
Two facts you needA = 1  (plain letter means the value is 1)
A = 0  (A = "A NOT" → say NOT A; bar means NOT, value 0)
Remember: inside a row the letters are multiplied (AND, A·B·C). Different rows are added (OR, +).

Steps

STEP 1: Mark the rows with output 1 — ignore the rows whose output is 0.

STEP 2: For each marked row write A or A / B or B / C or C — value 1 → plain letter, value 0 → barred letter. Multiply them, then + between rows.

Q3(a)Case 4 · truth table → expression

A Boolean algebraic expression produces the truth table below (X = 1 in six rows). Write the expression.

INPUT ABCOUTPUT X
0001✓
0011✓
0101✓
0111✓
1001✓
1011✓
1100
1110
Row by row (only X = 1 rows):0 0 0 → A, B, C all 0 → A·B·C0 0 1 → C is 1 (plain) → A·B·C0 1 0 → A·B·C0 1 1 → A·B·C1 0 0 → A·B·C1 0 1 → A·B·Crows 1 1 0 and 1 1 1 have X = 0 → ignored
X = A·B·C + A·B·C + A·B·C + A·B·C + A·B·C + A·B·C
Board note: the last term on the board (row 6) reads like A·B·C̄, but row 6 is A = 1, B = 0, C = 1, so the correct term is A·B·C (as above).
Quick check: X = 0 only when A = 1 and B = 1, so this table is just A NAND B (not needed in the exam).

Don't simplify — simplifying with Boolean algebra is A2 and is done later.

10. Case 5 — Circuit from a Problem Statement

You are given a description of a system and must draw its circuit. These look the hardest but are also the easiest questions of the whole chapter — once you can turn the wording into an expression, the rest is Case 1. At first it feels hard; later it becomes easy. This type is an A-Level style (not in O-level).

Note: Always write the expression first. Never start drawing randomly — first the expression, then the circuit.
① give eachparameter a letter② words → gates(AND / OR)③ write theEXPRESSION④ draw circuit(Case 1)
method for problem-statement questions
Key words (usually in bold): and → AND  |  or / either … or → OR  |  "any one or more" → OR (which gate gives 1 if even one input is 1? OR!). 1 = True, so write the plain letter (not barred). Sub-points (the little bullet circles) → the "and" in front applies to the pair together, so bracket them.
Q3(a) [5]Case 5 · bank approval

A bank approves a customer (X = 1) if the person:

  • is over 21 and employed
  • or
  • is over 21 and self-employed and — either earns more than 30 000 or has another account.
ParameterDescription1 = True / 0 = False
AEmployed1 / 0
BSelf-employed1 / 0
COver 211 / 0
DEarn more than 30 0001 / 0
EAnother account1 / 0

Draw a logic circuit to represent the model.

Make the expression (words → letters):"over 21 and employed" → C AND A"or" → this whole thing is ORed with the next part"over 21 and self-employed" → C AND Bsub-points "either D or E" → (D OR E), and the "and" before them joins it to C AND BX = (C AND A) OR (C AND B AND (D OR E))
X = (C AND A) OR ( C AND B AND (D OR E) )
Q3(a) — circuit
ABCDEX
C·A | C·B | D+E → AND them → OR with C·A

This is just Case 1 again: make C AND A; make D OR E; make C AND B and AND it with (D OR E); finally OR the two big parts → X. Solve the top part first, then ignore it and solve the bottom part (5 marks).

Q4(a) [3]Case 5 · alarm system

An alarm system (X) is enabled and disabled using either a switch (A) or a remote control (B). There are two infra-red sensors (C, D) and one door pressure sensor (E).

ParameterDescription10
ASwitchswitch enabledswitch disabled
BRemote controlremote enabledremote disabled
CInfra-red sensoractivatednot activated
DInfra-red sensoractivatednot activated
EDoor pressure sensoractivatednot activated

The alarm sounds (X = 1) if the alarm is enabled and any one or more of the sensors is activated. Draw a logic circuit for the alarm system.

Make the expression:"enabled using either A or B" → (A OR B)"and" → AND gate between the two parts"any one or more of the sensors" → (C OR D OR E)X = (A OR B) AND (C OR D OR E)
X = (A OR B) AND (C OR D OR E)
Q4(a) — circuit
ABCDEX
OR(A,B) | OR(C,D) then OR with E | AND

Three-input OR = two OR gates: C OR D first, then that answer OR E. Connect OR(A,B) and the second answer to the final AND → X (3 marks). If asked, you can now also fill its truth table.

11. Exam Tips & Practice

  • Practice = marks. Do the topical past papers (especially the drawing / problem-statement questions); each takes only ~5 minutes once you get the logic.
  • The main skill is logic building — reading a question and building the expression yourself, especially in problem-statement questions.
  • Draw circuits roughly in pencil, then redo in pen. Use a scale / neat drawing only when your time management allows (it comes after practising yearly past papers).
  • Truth tables: write all working in the space given, name every gate output, don't solve in your head — exam pressure is high and one wrong bit costs marks.
  • Marks are for the final answer (not the working) but still show working.
  • Always: expression first, then circuit.
✓ Quick Recap — all six gates
GateRule (one-liner)Logic notationBoolean00011011
NOTinverse (1 input)X = NOT AA1—0—
ORany 1 → 1X = A OR BA + B0111
ANDany 0 → 0X = A AND BA · B0001
NANDinverse of ANDX = A NAND BA·B1110
NORinverse of ORX = A NOR BA + B1000
XORsame 0, different 1X = A XOR BA ⊕ B0110

NOT row: input 0 → 1, input 1 → 0. Rows in a table = 2n; fill inputs by halving (4×0,4×1 / 2,2 / 1,1).

✓ Quick Recap — the 5 cases
  • 1. Expression → circuit: brackets first; NOT(AND) = NAND, NOT(OR) = NOR.
  • 2. Circuit → truth table: all combinations, name each gate output (D, E, F…), fill column by column, copy far inputs beside the column, last column = X.
  • 3. Circuit → expression: one bracket per gate, start from the left/top, "NOT A" not "A NOT".
  • 4. Truth table → expression: mark X = 1 rows; 1 → A, 0 → A; multiply inside a row, add rows.
  • 5. Problem statement → circuit: letters for parameters, and/or from keywords, write expression first, then draw (Case 1).