A-level Computer Science revision · Boolean algebra and logic

Logic gates and truth tables

The idea

Logic gates process Boolean inputs. AND outputs 1 only if both inputs are 1; OR if either is 1; NOT inverts; XOR if exactly one input is 1. A truth table lists the output for every input combination; n inputs give 2ⁿ rows. Boolean notation: ∧ (AND), ∨ (OR), ¬ (NOT), ⊻ (XOR).

  1. List all input combinations.
  2. Work through the circuit gate by gate.
  3. Write the output column.

Watch out XOR is 0 when both inputs are 1; OR is 1.

See it worked

Worked example

Find Q = (A AND B) OR NOT C when A = 1, B = 0, C = 0.

  1. A AND B = 0.
  2. NOT C = 1.
  3. 0 OR 1 = 1.

Answer Q = 1

Your turn

Question 12 marks

How many rows does a truth table with 4 inputs need?

Question 21 mark

Which gate outputs 1 when exactly one of its two inputs is 1?

Choose one
Question 31 mark

A = 1, B = 1. What is NOT(A AND B)?

Choose one

A-level Computer Science Pro, OCR H446

A-level Computer Science Pro

£119 once

Price rises to £199 on 1 January. Save £80 by joining before then.

At least 12 months of access

By paying you agree to our Terms and get access straight away, which ends your 14-day cancellation right.

No VAT is charged.

Independent practice for OCR A-level Computer Science (H446), not endorsed by OCR.

Privacy · Terms