SLIDE 1 / 11
CSZone.co.uk
OCR H446 · Component 1 · 1.4.3

Logic Gates
& Truth Tables

OCR A Level Computer Science · cszone.co.uk
H446 SpecA Level
Learning Objectives

By the end of this topic you will be able to:

Identify and describe the function of NOT, AND, OR, NAND, NOR and XOR gates
Construct and complete truth tables for single and combined logic gates
Write Boolean expressions from logic gate diagrams and vice versa
Trace outputs of combined logic circuits
Logic Gates

Basic Logic Gates

NOT (Inverter)
¬A / A'

Input → Output
0 → 1
1 → 0
AND
A ∧ B / A·B

1 only when
BOTH inputs are 1
OR
A ∨ B / A+B

1 when
AT LEAST ONE input is 1
NAND
¬(A·B)

NOT AND — 0 only
when both inputs are 1
NOR
¬(A+B)

NOT OR — 1 only
when both inputs are 0
XOR (EOR)
A ⊕ B

1 when inputs
are DIFFERENT
Truth Tables

Truth Tables for All Gates

ABANDORXOR
00000
01011
10011
11110
ABNANDNOR
0011
0110
1010
1100
NAND and NOR are universal gates — any logic function can be built using only NAND gates or only NOR gates.
Boolean Expressions

Boolean Expressions from Gate Diagrams

To write a Boolean expression from a circuit: work left-to-right, labelling the output of each gate in terms of its inputs.
Example Circuit
Inputs: A, B, C
Gate 1: AND(A, B) → outputs A·B
Gate 2: NOT(C) → outputs ¬C
Gate 3: OR(Gate1, Gate2) → outputs (A·B) + ¬C

To trace: substitute values of A, B, C into the expression.
Combined Circuits

Tracing a Combined Logic Circuit

Circuit: Q = (A NAND B) AND C
Q = ¬(A·B) · C
ABCA·B¬(A·B)Q = ¬(A·B)·C
000010
001011
101011
111100
Exam Practice
OCR H446 Style · 4 marks
Write out the complete truth table for the expression Q = (A OR B) AND (NOT C). Show all intermediate values.
[4 marks]
1
Intermediate columns needed: (A OR B) and (NOT C). Then Q = (A OR B) AND (NOT C).
2
8 rows (A,B,C: 000 to 111). Key outputs: 000→0, 001→0, 010→1, 011→0, 100→1, 101→0, 110→1, 111→0. Q=1 when at least one of A/B is 1 AND C is 0. [Award 2 marks for correct final column, 1 for correct intermediate columns]
1
All 8 rows present with correct A,B,C bit pattern; truth table headed correctly with Q column.
Common Mistakes

Don't Lose Marks

!
Confusing XOR with OR — XOR (exclusive OR) outputs 1 when inputs are different. OR outputs 1 when at least one input is 1 — including when both are 1. XOR outputs 0 when both inputs are 1. They share three of four rows but differ when A=B=1.
!
Missing rows from truth tables — an n-input truth table has 2ⁿ rows: 2 inputs → 4 rows, 3 inputs → 8 rows, 4 inputs → 16 rows. Always start from 000...0 and count up systematically to avoid missing combinations.
!
Saying NAND is the same as AND with NOT on the output only — NAND is indeed NOT(AND), so its output is the inverse of AND. This is correct. The common mistake is writing the NAND truth table as if it were AND. Always invert the AND column to get NAND.
1.4.3a Complete
Well done! ✓
Logic Gates and Truth Tables
Return to lesson to continue