GCSE Revision Aid: This resource is designed to support your revision and may contain errors. If you find a discrepancy with your class teaching, your teacher is correct — please let us know at gcserevise@scott.scottrix.co.uk.

CS24: Boolean Logic

Foundation Higher AQAEdexcelOCREduqasCCEA Computer Systems

Logic gates (NOT, AND, OR, XOR), truth tables, Boolean expressions, and combining gates into logic circuits.

Fastmail

📋 What is Boolean Logic?

Definition: Boolean logic is a form of algebra where all values are either TRUE (1) or FALSE (0). It is named after mathematician George Boole and forms the basis of how computers make decisions.

Computers process all data as binary (0s and 1s). Boolean logic allows computers to make decisions based on these binary values. Logic gates are the physical electronic circuits that implement Boolean logic operations. Each gate takes one or more binary inputs and produces a single binary output.

🚫 NOT Gate

NOT gate: Takes a single input and produces the opposite (inverted) output. If input is 1, output is 0. If input is 0, output is 1. Also called an inverter.

Boolean expression: Q = A (spoken as "NOT A" or "A bar")

Input A Output Q
0 1
1 0
Example

If A = 1 (TRUE), then NOT A = 0 (FALSE). If a sensor detects that a door is open (1), the NOT gate would output that the door is NOT closed (0 is false - it's not closed).

🔗 AND Gate

AND gate: Takes two inputs and outputs 1 (TRUE) only if BOTH inputs are 1. If either or both inputs are 0, the output is 0.

Boolean expression: Q = A . B (spoken as "A AND B" - the dot represents AND)

Input A Input B Output Q
0 0 0
0 1 0
1 0 0
1 1 1
Example

A car engine should only start if the key is turned (A = 1) AND the brake is pressed (B = 1). If either condition is not met, the engine will not start (Q = 0).

🔀 OR Gate

OR gate: Takes two inputs and outputs 1 (TRUE) if EITHER or BOTH inputs are 1. The output is 0 only when both inputs are 0.

Boolean expression: Q = A + B (spoken as "A OR B" - the plus represents OR)

Input A Input B Output Q
0 0 0
0 1 1
1 0 1
1 1 1
Example

An alarm should sound if the front door is open (A = 1) OR the back door is open (B = 1). If either door is open, the alarm triggers.

✖️ XOR Gate (Exclusive OR)

XOR gate: Takes two inputs and outputs 1 (TRUE) if the inputs are DIFFERENT. If both inputs are the same (both 0 or both 1), the output is 0. Think of it as "one or the other, but not both."

Boolean expression: Q = A ⊕ B (spoken as "A XOR B")

Input A Input B Output Q
0 0 0
0 1 1
1 0 1
1 1 0
Example

A light with two switches (like a staircase light) uses XOR logic. When the switches are in different positions, the light is on. When both are in the same position, the light is off.

Key Difference - OR vs XOR:
OR outputs 1 when A=1, B=1 (both true)
XOR outputs 0 when A=1, B=1 (both true)
XOR is "exclusive" - it excludes the case where both are true

🔧 Combining Gates into Circuits

Key Concept: Logic gates can be combined (cascaded) to create more complex circuits. The output of one gate can become the input of another. Circuits with up to 3 inputs may appear in exams.

Method for Solving Logic Circuits

  1. Identify each gate in the circuit and label its output
  2. Work through the circuit from left to right (inputs to outputs)
  3. For each gate, determine its output based on its inputs
  4. Use the intermediate outputs as inputs for the next gate
  5. Build the complete truth table column by column
Example: Circuit with expression Q = NOT (A AND B)

This circuit has an AND gate followed by a NOT gate (also called a NAND gate).

A B A . B NOT (A . B)
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
Example: 3-Input Circuit Q = (A OR B) AND C
A B C A + B (A + B) . C
0 0 0 0 0
0 0 1 0 0
0 1 0 1 0
0 1 1 1 1
1 0 0 1 0
1 0 1 1 1
1 1 0 1 0
1 1 1 1 1

📝 Boolean Expressions

Boolean Notation:
AND = dot ( . ): A . B means "A AND B"
OR = plus ( + ): A + B means "A OR B"
NOT = overbar ( ̅ ): A means "NOT A"
XOR = ⊕ symbol: A ⊕ B means "A XOR B"

Order of operations: NOT first, then AND, then OR
Brackets override normal order of operations
Drawing Circuits from Expressions

Expression: Q = A . B

This means: NOT A is ANDed with B. The circuit has: A goes into a NOT gate, the output of NOT A goes into an AND gate along with B.

Expression: Q = (A + B) . C

This means: (A OR B) is ANDed with NOT C. The circuit has: A and B go into an OR gate, C goes into a NOT gate, then both outputs go into an AND gate.

Expression: Q = A . B + C

This means: (A AND B) OR C. The circuit has: A and B go into an AND gate, the result is ORed with C. (AND is evaluated before OR.)

⚖️ Gate Summary Comparison

Gate Inputs Output is 1 when... Expression
NOT 1 Input is 0 A
AND 2 Both inputs are 1 A . B
OR 2 Either or both inputs are 1 A + B
XOR 2 Inputs are different A ⊕ B
NAND 2 NOT both inputs are 1 A . B
NOR 2 Both inputs are 0 A + B

⚠️ Common Mistakes to Avoid

Mistake Why It's Wrong How to Fix It
Confusing OR and XOR OR gives 1 when both are 1; XOR gives 0 Remember: XOR = "exclusive" = one OR the other, not both
Wrong order of operations NOT, AND, OR - not left to right Apply NOT first, then AND, then OR; use brackets to clarify
Missing rows in truth tables 2 inputs = 4 rows; 3 inputs = 8 rows Count in binary: 00, 01, 10, 11 for 2 inputs
Forgetting intermediate columns Working out the final column in your head leads to errors Always show intermediate steps as separate columns

❓ Practice Questions

Q1: Draw the truth table for Q = A . B

Q2: A circuit has the expression Q = (A OR B) AND NOT C. Draw the full truth table.

Q3: What is the difference between OR and XOR? Give a real-world example of each.

Q4: Write the Boolean expression for a circuit where A and B go into an OR gate, and the output is fed into a NOT gate.

Q5: How many rows does a truth table need for a circuit with 3 inputs?

✅ Answers

  1. Q = A . NOT B: A=0 B=0 Q=0; A=0 B=1 Q=0; A=1 B=0 Q=1; A=1 B=1 Q=0. Output is 1 only when A=1 AND B=0.
  2. Three inputs = 8 rows. Q=1 only when (A=1 OR B=1) AND C=0. Rows where Q=1: (0,1,0), (1,0,0), (1,1,0). All other rows Q=0.
  3. OR outputs 1 if either or both inputs are 1. XOR outputs 1 only if the inputs are different. OR example: alarm if front OR back door is open. XOR example: staircase light controlled by two switches - on when switches differ.
  4. Q = A + B (this is the NOR gate function)
  5. 23 = 8 rows, covering all combinations from 000 to 111.

🎯 Exam Tips

⚠️ Common Errors

✗ Confusing AND, OR, NOT gates with their truth table outputs ✓ AND: output 1 only when ALL inputs are 1. OR: output 1 when ANY input is 1. NOT: output is the opposite of the input. Memorise the truth tables.

✗ Drawing logic gate symbols incorrectly in exams ✓ AND gate: D-shape. OR gate: curved D with curved input side. NOT gate: triangle with circle. Each symbol is distinct — practice drawing them.

✗ Forgetting that a NOT gate can only have ONE input ✓ NOT (inverter) takes exactly one input and produces the opposite. It cannot have two inputs. AND and OR gates can have two or more inputs.

✗ Not recognising that NAND and NOR are the negated versions of AND and OR ✓ NAND = NOT AND (output is opposite of AND). NOR = NOT OR (output is opposite of OR). Adding the circle (bubble) on the output inverts the gate's normal result.

✍️ Model Answer

Full-Mark Response

Draw and complete the truth table for the following logic circuit: A AND B is fed into a NOT gate. Then explain what type of gate this combination produces. [4 marks]

The circuit is: A AND B → NOT = NAND gate A | B | A AND B | NOT (A AND B) 0 | 0 | 0 | 1 0 | 1 | 0 | 1 1 | 0 | 0 | 1 1 | 1 | 1 | 0 This combination produces a NAND gate. The output is 0 only when both inputs are 1, and 1 in all other cases. The NAND gate is the negation of the AND gate — adding a NOT gate to the output of an AND gate produces the NAND truth table.

📊 AO Deep Dive

Assessment Objective Analysis

AO1 (Computational Thinking — 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including Boolean logic and logic gates: AND, OR and NOT for AQA 8525, OCR J277 & Edexcel 1CP2.

AO2 (Application — 40%): Apply knowledge and understanding of computer science, including Boolean logic and logic gates: AND, OR and NOT to analyse problems in computational terms and to design, write and evaluate solutions.

AO3 (Evaluation — 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including Boolean logic and logic gates: AND, OR and NOT, and make reasoned judgements about trade-offs.

📝 Exam Technique

GCSE Computer Science Exam Tips:
Learn truth tables for AND, OR, NOT, NAND, NOR, XOR. AND: all 1s → 1. OR: any 1 → 1. NOT: flip. NAND = NOT AND. NOR = NOT OR. XOR: different inputs → 1. Draw gate symbols clearly. For logic circuits, work through gate by gate from inputs to output. Complete intermediate columns in truth tables. NAND is a universal gate — any logic function can be built from NAND gates alone.

📝 Exam Questions by Topic

🎬 Video Resources

Share this page

Ready to ace your GCSE Computer Science exams?

Get the best revision books and guides to boost your grades.