Paper 2 · J277/02 · unit 2.4

Boolean logic

AND, OR, NOT, truth tables, combined expressions, logic diagrams. Practice tables and a quiz — skip around freely.

Everything on this course is open. Skip, jump, retry. Nothing is locked and there is no required order.

AND, OR, NOT — the same ideas as and / or / not in Python, drawn as gates and truth tables. Short unit. High value per minute.

2.4.1 Boolean logic

The three operators

Treat 1 as True, 0 as False. OCR accepts T/F as well.

NOT — one input, flips it.

A NOT A
0 1
1 0

AND — 1 only if both inputs are 1.

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

OR — 1 if at least one input is 1.

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

This is inclusive OR (1 OR 1 is 1). Not “exclusive or” unless they say XOR (they usually do not at GCSE).

Combining

Work inside brackets first, same as maths. A common pattern:

Q = (A AND B) OR (NOT C)

Build a truth table with columns for every sub-expression, not just inputs and final Q. That is how you avoid losing a mark on row 6 of 8.

For 3 inputs there are 2³ = 8 rows. List them in binary counting order (000, 001, 010, …) so you do not skip.

Logic diagrams

Standard gate shapes (practice drawing them):

  • AND — D-shape
  • OR — curved input side
  • NOT — triangle with a bubble

Wires from inputs on the left to output on the right. A dot on a join means a connection; crossing without a dot is not a join.

You must go both ways: table → diagram, diagram → expression → table.

Link to programs

if logged_in AND (role == "admin" OR debug): is the same Boolean as the gates. If you can trace the if, you can fill the table.


Exercises are “complete the table” and “write the expression”. Reveal the model; then invent one of your own with three inputs.

Practice · optional · answers on this page

Exercises

Do as many or as few as you like, in any order. Hints and a model answer sit under each task.

2.4.1 · e1 paper

Fill AND / OR / NOT

Without looking up, write the output column for: 1. NOT 0 and NOT 1 2. 1 AND 0 3. 1 OR 0 4. 1 AND 1 5. 0 OR 0
Hint
AND is the strict one. OR is generous. NOT flips.
Show a model answer
1. 1 and 0 2. 0 3. 1 4. 1 5. 0
2.4.1 · e2 paper

Two-input expression

Q = (A OR B) AND (NOT A) Complete a 4-row table with columns A, B, A OR B, NOT A, Q.
Hint
When A is 1, NOT A is 0, so AND makes Q 0. When A is 0, Q equals B.
Show a model answer
A B | AORB | NOTA | Q 0 0 | 0 | 1 | 0 0 1 | 1 | 1 | 1 1 0 | 1 | 0 | 0 1 1 | 1 | 0 | 0 Q is 1 only on row A=0, B=1.
2.4.1 · e3 paper

Expression from English

A lamp turns on if the switch is on AND (it is night OR the override is on). Inputs: S, N, O. Write Q = ...
Hint
Brackets around the OR.
Show a model answer
Q = S AND (N OR O)
2.4.1 · e4 think

Draw it

On paper, draw gates for Q = A AND (NOT B). Two inputs, one NOT, one AND. Then pick one row (A=1, B=1) and write the output of each gate.
Hint
NOT B first, then AND with A. For A=1 and B=1, NOT B is 0 so Q is 0.
Show a model answer
NOT gate on B. AND gate takes A and the NOT output. A=1, B=1 → NOT B = 0 → 1 AND 0 = 0.

Check yourself · not a gateway

Quiz

Mark it, reveal it, or skip it. A low score does not close anything. Try again as often as you want.

1 2.4.1 The output of AND is 1 only when…
2 2.4.1 How many rows does a truth table with 3 inputs need?
3 2.4.1 NOT 1 equals…
4 2.4.1 1 OR 1 equals…
5 2.4.1 You should include extra columns for sub-expressions in a combined truth table.
6 2.4.1 Which are Boolean operators in this spec? (Select all that apply)