CHAPTER 10
Boolean Logic & Logic Gates
100% COMPLETE A* EDITION
Cambridge O Level Computer Science 2210
WHY CHAPTER 10 IS CRITICAL:
• 10-15% of Paper 1 marks
• Logic gates in EVERY Paper 1
• Truth tables guaranteed questions
• Circuit drawing/analysis tested every year
• Easy marks if you know the patterns
ALL 10 SECTIONS COVERED:
1. Boolean Logic Basics
2. Logic Gates (AND, OR, NOT)
3. Advanced Gates (NAND, NOR, XOR)
4. Truth Tables (Complete Guide)
5. Boolean Expressions
6. Drawing Circuits from Expressions
7. Writing Expressions from Circuits
8. Evaluating Circuits
9. Simplifying Logic (De Morgan's Laws)
10. Exam Mastery & Applications
SECTION 1: BOOLEAN LOGIC BASICS
1.1 What is Boolean Logic?
Boolean logic uses TRUE (1) and FALSE (0) to make decisions.
Named after:
George Boole, mathematician who invented Boolean algebra in 1854.
Two values only:
Name Symbol Meaning
TRUE 1 ON, YES, HIGH voltage
FALSE 0 OFF, NO, LOW voltage
1.2 Why Boolean Logic Matters
Used everywhere in computing:
• Computer processors (billions of logic gates)
• Programming (IF statements use Boolean logic)
• Circuits (all digital devices)
• Search engines (AND, OR, NOT operators)
1.3 Real-Life Example
Smart home light control:
Light turns ON if:
• Motion sensor detects movement AND it's dark outside
This is Boolean logic: (Motion = TRUE) AND (Dark = TRUE) → Light = TRUE
🔑 KEY: Boolean logic is the foundation of ALL digital computing.
SECTION 2: BASIC LOGIC GATES
2.1 What is a Logic Gate?
An electronic circuit that performs a logical operation on one or more inputs and produces ONE
output.
Input and Output:
• Inputs: Can be 0 or 1 (typically labeled A, B, C, etc.)
• Output: Can be 0 or 1 (typically labeled Q or Y)
2.2 AND Gate
Rule: Output is 1 ONLY if ALL inputs are 1
Symbol:
(See gate symbol with flat left side, curved right side)
Inputs: A and B on left
Output: Q on right
Truth Table:
A B Q = A AND B
0 0 0
0 1 0
1 0 0
1 1 1
Boolean Expression:
Q = A AND B
or: Q = A . B (using dot)
or: Q = A ∧ B (using wedge)
Real-world example:
Car engine starts ONLY if key inserted AND brake pedal pressed.
🔑 KEY: AND gate: Output 1 only when ALL inputs are 1. Otherwise output 0.
2.3 OR Gate
Rule: Output is 1 if ANY input is 1
Symbol:
(See gate symbol with curved left and right sides)
Truth Table:
A B Q = A OR B
0 0 0
0 1 1
1 0 1
1 1 1
Boolean Expression:
Q = A OR B
or: Q = A + B (using plus)
or: Q = A ∨ B (using vee)
Real-world example:
Door opens if you use key OR fingerprint scanner.
🔑 KEY: OR gate: Output 1 if AT LEAST ONE input is 1. Only 0 when all inputs are 0.
2.4 NOT Gate (Inverter)
Rule: Output is OPPOSITE of input
Symbol:
(See triangle with small circle on output)
Only ONE input
Truth Table:
A Q = NOT A
0 1
1 0
Boolean Expression:
Q = NOT A
or: Q = Ā (bar over A)
or: Q = -A (negation symbol)
Real-world example:
If switch is OFF (0), light is ON (1). If switch is ON (1), light is OFF (0).
🔑 KEY: NOT gate: Flips the input. 0 becomes 1, 1 becomes 0.
SECTION 3: ADVANCED LOGIC GATES
3.1 NAND Gate
Rule: NOT AND — opposite of AND gate
Output is 0 ONLY if ALL inputs are 1
Symbol:
(AND gate symbol with small circle on output)
Truth Table:
A B Q = A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
Boolean Expression:
Q = NOT (A AND B)
or: Q = ‾ (A . B)
🔑 KEY: NAND = NOT + AND. It's the opposite of AND.
3.2 NOR Gate
Rule: NOT OR — opposite of OR gate
Output is 1 ONLY if ALL inputs are 0
Symbol:
(OR gate symbol with small circle on output)
Truth Table:
A B Q = A NOR B
0 0 1
0 1 0
1 0 0
1 1 0
Boolean Expression:
Q = NOT (A OR B)
or: Q = ‾ (A + B)
🔑 KEY: NOR = NOT + OR. It's the opposite of OR.
3.3 XOR Gate (Exclusive OR)
Rule: Output is 1 if inputs are DIFFERENT
Output is 1 if EXACTLY ONE input is 1 (not both)
Symbol:
(OR gate with extra curved line on left)
Truth Table:
A B Q = A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
Boolean Expression:
Q = A XOR B
or: Q = A ⊕ B (using circle plus)
Real-world example:
Room with 2 light switches. Light is ON if switches are in DIFFERENT positions.
🔑 KEY: XOR: Output 1 when inputs are DIFFERENT. Output 0 when inputs are SAME.
3.4 All Six Gates — Quick Summary
Gate Output = 1 when Expression Has circle?
AND ALL inputs are 1 A. B No
OR ANY input is 1 A+B No
NOT Input is 0 Ā Yes
NAND NOT all inputs are 1 ‾ (A . B) Yes
NOR NO inputs are 1 (all 0) ‾ (A + B) Yes
XOR Inputs are DIFFERENT A⊕B No
★ EXAM TIP: Small circle on output = NOT function. NAND and NOR have circles.
SECTION 4: TRUTH TABLES [CRITICAL FOR EXAMS]
4.1 What is a Truth Table?
A table showing ALL possible input combinations and corresponding outputs.
4.2 How to Create a Truth Table
Step 1: List ALL inputs
If 2 inputs (A, B): 4 rows (2² = 4)
If 3 inputs (A, B, C): 8 rows (2³ = 8)
If 4 inputs: 16 rows (2⁴ = 16)
Step 2: List all combinations
Start with all 0s, count up in binary
Step 3: Calculate output for each row
4.3 Example: Create Truth Table for (A AND B) OR C
Step 1: 3 inputs → 8 rows
Step 2 & 3: Fill in all combinations and calculate
A B C A AND B (A AND B) OR C
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 1
Working:
• Row 1: A=0, B=0, C=0 → A AND B = 0, 0 OR 0 = 0
• Row 2: A=0, B=0, C=1 → A AND B = 0, 0 OR 1 = 1
• Row 8: A=1, B=1, C=1 → A AND B = 1, 1 OR 1 = 1
★ EXAM TIP: Add intermediate columns to show working. Makes it easier to avoid mistakes.
4.4 Truth Table Shortcuts
For 2 inputs (4 rows):
Always list as: 00, 01, 10, 11
For 3 inputs (8 rows):
First input: 0000 1111
Second input: 0011 0011
Third input: 0101 0101
⚠ WARNING: Never miss a row! If asked for 3 inputs and you only do 4 rows, you lose ALL marks.
SECTION 5: BOOLEAN EXPRESSIONS
5.1 What is a Boolean Expression?
A mathematical way to write logic using symbols:
Operation Symbols Example
AND . or ∧ A. B or A ∧ B
OR + or ∨ A + B or A ∨ B
NOT ¯ or ¬ Ā or ¬A
5.2 Writing Expressions from Words
Example 1:
"Output is 1 if A is 1 AND B is 0"
Expression: Q = A. (NOT B) = A. B̄
Example 2:
"Output is 1 if A is 1 OR (B is 1 AND C is 0)"
Expression: Q = A + (B. C̄ )
5.3 Order of Operations
Like BODMAS in math:
• 1. Brackets first
• 2. NOT next
• 3. AND next
• 4. OR last
Example:
A + B. C means: A + (B. C)
NOT A + B. C: Do brackets, then NOT, then AND, then OR
SECTION 10: EXAM MASTERY
10.1 Most Common Exam Questions
• Draw truth table for given expression (6-8 marks)
• Draw logic circuit from expression (4-6 marks)
• Write expression from circuit diagram (4-5 marks)
• Complete truth table from circuit (6-8 marks)
• Simplify logic expression (4-5 marks)
10.2 Quick Reference
Gate Truth Expression Remember
AND 1 only if ALL 1 A.B Strict - needs both
OR 1 if ANY 1 A+B Relaxed - needs one
NOT Opposite Ā Flip it
NAND 0 only if ALL 1 (A . B)‾ Opposite of AND
NOR 1 only if ALL 0 (A + B)‾ Opposite of OR
XOR 1 if DIFFERENT A⊕B Different = 1
10.3 Common Mistakes
Mistake Correct
Missing rows in truth table 2 inputs = 4 rows, 3 inputs = 8 rows
Wrong gate symbol Check circles - NAND/NOR have them
Wrong order: A OR B AND C Brackets: A OR (B AND C)
Confusing XOR with OR XOR: different=1, OR: any=1
★ EXAM TIP: Practice drawing ALL 6 gate symbols until you can do them perfectly from memory.
END OF CHAPTER 10
Master logic gates and score easy marks!