TopMyGrade

GCSE/Computer Science/AQA

CS4.2Boolean logic: AND, OR, NOT gates; logic circuit diagrams and truth tables; constructing simple expressions and simplification

Notes

Boolean logic

Boolean logic uses two values — true (1) and false (0) — and three fundamental operations: AND, OR, NOT. Real CPUs are built from millions of gates implementing these operations. AQA expects you to construct truth tables, draw circuits, and write Boolean expressions.

The three gates

NOT (inverter)

One input, one output. Output = the opposite of the input.

ANOT A
01
10

Symbol: a triangle with a small circle at the output.

AND

Two inputs, one output. Output = 1 only if both inputs are 1.

ABA AND B
000
010
100
111

Symbol: a D-shape (flat input side, rounded output side).

OR

Two inputs, one output. Output = 1 if at least one input is 1.

ABA OR B
000
011
101
111

Symbol: a curved-back shield.

Building expressions

Combine gates to build any logic. Operator precedence (highest first): NOT, AND, OR — like arithmetic's BIDMAS.

A AND (NOT B)         -- A and the inverse of B
(A OR B) AND C        -- at least one of A, B, AND c is 1
NOT (A AND B)         -- NAND — at least one is 0

Truth tables for compound expressions

Build a truth table by enumerating all combinations of inputs (2ⁿ rows for n inputs), then computing the expression column by column.

Worked example: (A AND B) OR (NOT C).

ABCA AND BNOT C(A AND B) OR (NOT C)
000011
001000
010011
011000
100011
101000
110111
111101

Circuit diagrams

To draw the circuit for (A AND B) OR (NOT C):

  1. Three input wires labelled A, B, C.
  2. Pass A and B into an AND gate.
  3. Pass C through a NOT gate (inverter).
  4. Feed the AND-output and the NOT-output into an OR gate.
  5. The OR gate output is Q.

Simplifying expressions

You don't need to know full Boolean algebra at GCSE, but recognise simple identities:

  • A AND 1 = A
  • A AND 0 = 0
  • A OR 1 = 1
  • A OR 0 = A
  • A AND A = A; A OR A = A
  • A AND (NOT A) = 0
  • A OR (NOT A) = 1
  • NOT (NOT A) = A (double negation)

Real-world meaning

Each gate corresponds to a physical electronic component made of transistors. A modern CPU contains billions. Boolean logic is the mathematics of digital design — every program runs as Boolean operations on bits.

Common mistakesPitfalls

  1. Reading the wrong column. With 3 inputs you have 8 rows — write them out systematically (binary count 000 to 111).
  2. Mixing up AND and OR. AND needs all 1s; OR needs at least one 1.
  3. Forgetting NOT first. A AND NOT B means A AND (NOT B), not NOT (A AND B).
  4. Drawing decisions in flowcharts as logic gates. They're different conventions — a flowchart diamond is a decision; a logic-gate diagram is a circuit.
  5. Putting NOT in the wrong place in a circuit. A NOT gate (small circle) inverts whatever wire it sits on.

Worked exampleWorked example — security door

A door unlocks if the user has a valid keycard AND knows the PIN, OR if the override switch is on. Let K = keycard valid, P = PIN correct, S = override switch on.

Q = (K AND P) OR S.

Truth table (8 rows): unlock (Q=1) when both K and P are 1, OR whenever S is 1.

Try thisQuick check

Complete the truth table for NOT (A OR B):

ABA OR BNOT (A OR B)
0001
0110
1010
1110

This is NOR — output is 1 only when both inputs are 0.

AI-generated · claude-opus-4-7 · v3-deep-computer-science

Practice questions

Try each before peeking at the worked solution.

  1. Question 14 marks

    AND truth table

    Complete the truth table for A AND B for all four input combinations.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  2. Question 22 marks

    OR vs AND

    State two differences between OR and AND in terms of output.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  3. Question 34 marks

    Compound truth table

    Construct a truth table for the expression NOT A AND B.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  4. Question 44 marks

    Three-input expression

    Construct a truth table for (A OR B) AND C.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  5. Question 53 marks

    Identify circuit

    A logic circuit takes inputs A and B, passes them both into an AND gate, then passes the AND gate's output through a NOT gate. Write the Boolean expression and name the resulting gate.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  6. Question 63 marks

    Simplify

    Simplify the Boolean expression A AND (A OR B). Show your reasoning.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  7. Question 73 marks

    Word problem to expression

    An alarm sounds (Q) if a sensor detects motion M AND it is night-time (N), OR if a panic button (P) is pressed. Write the Boolean expression for Q.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

Flashcards

CS4.2 — Boolean logic — gates, expressions and truth tables

12-card SR deck for AQA GCSE Computer Science topic CS4.2

12 cards · spaced repetition (SM-2)