✓ Free · Component 1 · 1.4.3 Boolean Algebra
1.4.3a Logic Gates and Truth Tables
OCR H446 · A Level Computer Science · ~14 min read
Notes
Video
Slides
Worksheet
Quiz

Boolean Algebra and Logic Gates

Boolean algebra operates on binary values: 1 (TRUE) and 0 (FALSE). Logic gates are the physical hardware implementations of Boolean operations. Every digital circuit — from a simple alarm to a CPU — is built from combinations of these fundamental gates.

The Seven Standard Logic Gates

NOT Gate (Inverter)

Inverts the input. One input, one output. Symbol: ¬A or or NOT A

ANOT A (¬A)
01
10

AND Gate

Output is 1 only when ALL inputs are 1. Symbol: A · B or A AND B

ABA AND B
000
010
100
111

OR Gate

Output is 1 when AT LEAST ONE input is 1. Symbol: A + B or A OR B

ABA OR B
000
011
101
111

NAND Gate (NOT AND)

Output is 0 only when ALL inputs are 1 (inverse of AND). Symbol: ¬(A · B)

ABA NAND B
001
011
101
110

NAND is universal — any logic gate (NOT, AND, OR, XOR, etc.) can be built from NAND gates alone. NAND gates are cheaper to manufacture.

NOR Gate (NOT OR)

Output is 1 only when ALL inputs are 0 (inverse of OR). Symbol: ¬(A + B)

ABA NOR B
001
010
100
110

NOR is also universal — any logic function can be built from NOR gates alone.

XOR Gate (Exclusive OR)

Output is 1 when inputs are DIFFERENT. Symbol: A ⊕ B or A XOR B

ABA XOR B
000
011
101
110

XNOR Gate (Exclusive NOR)

Output is 1 when inputs are THE SAME (inverse of XOR). Symbol: ¬(A ⊕ B)

ABA XNOR B
001
010
100
111

Constructing Truth Tables for Boolean Expressions

A truth table lists all possible input combinations and the corresponding output. For n inputs: 2ⁿ rows.

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

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

Method: Work left to right — compute each intermediate column before the final output. Evaluate brackets/NOT first, then AND, then OR.

Logic Gate Symbols (British Standard)

GateSymbol descriptionBoolean notation
NOTTriangle with bubble at output¬A, A̅, NOT A
ANDFlat on left, curved D on rightA · B, A AND B
ORCurved on both sides (like shield)A + B, A OR B
NANDAND symbol with bubble at output¬(A · B)
NOROR symbol with bubble at output¬(A + B)
XOROR symbol with extra curved line at inputA ⊕ B
XNORXOR symbol with bubble at output¬(A ⊕ B)
Exam tip: For truth tables with n inputs, you need 2ⁿ rows. Always list inputs in binary counting order (000, 001, 010, 011, 100, 101, 110, 111 for 3 inputs). Add intermediate columns for sub-expressions — you will lose marks if you jump to the answer without working.
Exam tip: NAND and NOR are "universal gates" — this means any other gate (NOT, AND, OR, XOR, XNOR) can be made using only NAND (or only NOR) gates. Examiners often ask you to implement NOT, AND, or OR using NAND gates only: NOT A = A NAND A. A AND B = (A NAND B) NAND (A NAND B).
⚠ Common Mistakes
  • Confusing XOR with OR — XOR outputs 0 when both inputs are 1 (OR outputs 1). "Exclusive" OR means exclusively one is 1, not both.
  • Wrong row count — 2 inputs = 4 rows, 3 inputs = 8 rows, 4 inputs = 16 rows.
  • Not adding intermediate columns — always show A AND B, NOT C etc. as separate columns. Jumping to the output loses working marks.
  • Confusing NAND (output 0 only when all inputs are 1) with NOR (output 1 only when all inputs are 0).
✓ Notes completed!
Video coming soon
Click to advance · Arrow keys also work
Click slide or press arrow keys to navigate

Worksheet — 1.4.3a Logic Gates and Truth Tables

8 questions · 20 marks · instantly marked

Q1Complete the full truth table for the expression: X = A OR (NOT B). Use all 4 input combinations.[3 marks]
✓ Mark scheme
A=0,B=0: NOT B=1, X=0 OR 1=1 [½ mark each row]. A=0,B=1: NOT B=0, X=0 OR 0=0. A=1,B=0: NOT B=1, X=1 OR 1=1. A=1,B=1: NOT B=0, X=1 OR 0=1. Correct all 4 rows [2 marks]; correct intermediate NOT B column [1 mark]. Total: [3 marks].
Q2State the output of an AND gate when: (a) A=1, B=0; (b) A=1, B=1; (c) A=0, B=0.[3 marks]
✓ Mark scheme
(a) 0 — AND requires ALL inputs to be 1 [1]. (b) 1 — both inputs are 1 [1]. (c) 0 — neither input is 1 [1].
Q3How does XOR differ from OR? When does XOR output 0 that OR does not?[2 marks]
✓ Mark scheme
XOR outputs 1 only when inputs are DIFFERENT (exactly one input is 1) [1]. When A=1 AND B=1: OR outputs 1, but XOR outputs 0 — this is the only combination where they differ [1]. XOR stands for "exclusive or" — exactly one of the inputs must be 1 (not both).
Q4Complete the full truth table for: X = (A NAND B) with all 4 input combinations.[2 marks]
✓ Mark scheme
A=0,B=0: NAND=1. A=0,B=1: NAND=1. A=1,B=0: NAND=1. A=1,B=1: NAND=0. [1 mark for all correct]; [1 mark for identifying NAND=0 only when A=1 AND B=1]. NAND is the inverse of AND — output is 0 ONLY when all inputs are 1.
Q5How many rows does a truth table with 3 inputs require? List all input combinations in binary counting order.[3 marks]
✓ Mark scheme
2³ = 8 rows [1]. Combinations in order: 000, 001, 010, 011, 100, 101, 110, 111 [2 marks — 1 for all 8 listed, 1 for correct binary counting order]. The pattern: rightmost bit alternates every row, middle bit alternates every 2 rows, leftmost bit alternates every 4 rows.
Q6Explain what it means for NAND to be a "universal gate". Give one example of how to implement a NOT gate using only NAND gates.[3 marks]
✓ Mark scheme
Universal gate: any Boolean logic function / any other gate can be constructed using only NAND gates [1]. This means an entire digital circuit can be built from NAND gates alone — making manufacturing simpler and cheaper [1]. NOT using NAND: connect both inputs of the NAND gate to the same signal A. A NAND A = ¬(A AND A) = ¬A. When A=0: NAND=1; when A=1: NAND=0 [1].
Q7Complete the truth table for the expression X = (A AND B) OR (A XOR C) for A=1, B=0, C=1.[3 marks]
✓ Mark scheme
Step by step: A=1, B=0, C=1. A AND B = 1 AND 0 = 0 [1]. A XOR C = 1 XOR 1 = 0 (inputs are same) [1]. X = 0 OR 0 = 0 [1]. Final answer: X = 0.
Q8Identify two real-world applications of logic gates in digital electronics.[4 marks]
✓ Mark scheme
Any two of [2 marks each]: Arithmetic Logic Unit (ALU) in a CPU — uses combinations of gates (AND, OR, XOR, adders) to perform arithmetic and logical operations [2]. Memory cells (flip-flops) — D-type flip-flops built from NAND gates to store one bit of data in registers and RAM [2]. Alarm systems — AND gates used to combine signals (e.g. sensor=ON AND time=night → activate alarm) [2]. Multiplexers/demultiplexers — used in telecommunications to select/route signals using combinations of AND, OR, NOT gates [2]. Digital comparators — XNOR gates used to compare two binary numbers bit by bit (XNOR outputs 1 when bits match) [2].
Topic Quiz
1 of 15
You scored
out of 15
🎯

Mini Test — 1.4.3a Logic Gates

  • 10 questions · 10 marks · 10 minutes
  • 5 MCQ + 5 short answer
Card 1 of 15
Click to reveal
🎉
Complete!
TermDefinition
← 1.4.2h Sorting & Searching 1.4.3 Boolean Algebra Next: 1.4.3b Boolean Algebra →