🔣 Component 2 · 2.4 Boolean Logic
2.4.1a Boolean Logic & Truth Tables
OCR J277 · GCSE Computer Science · ~12 min read · Free lesson
Notes
Video
Slides
Worksheet
Quiz

What is Boolean Logic?

Boolean logic is the foundation of computing. Every decision a computer makes is based on values that are either True (1) or False (0). Three fundamental Boolean operators are used in OCR J277: AND, OR, and NOT.

Boolean expressions evaluate to True or False. They are used in IF conditions, WHILE loops, and to design logic circuits.

The AND Operator

AND outputs True only when ALL inputs are True. If any input is False, the output is False.

Real example: "You can enter a concert IF you have a ticket AND you are over 18."

ABA AND B
000
010
100
111

The OR Operator

OR outputs True when AT LEAST ONE input is True. It only outputs False when ALL inputs are False.

Real example: "You get a discount IF you are a student OR a senior citizen."

ABA OR B
000
011
101
111

The NOT Operator

NOT takes a single input and inverts it. True becomes False; False becomes True.

Real example: "NOT logged in → show login page"

ANOT A
01
10

Combining Operators

Operators can be combined to make more complex expressions. Evaluate NOT first, then AND, then OR — unless brackets change the order.

Example: A AND NOT B

ABNOT BA AND NOT B
0010
0100
1011
1100

Boolean in Programming (OCR J277)

Boolean operators appear directly in OCR J277 pseudocode conditions:

IF age >= 18 AND hasTicket == True THEN
    OUTPUT "Entry granted"
END IF

IF isStudent OR isSenior THEN
    OUTPUT "Discount applied"
END IF

IF NOT loggedIn THEN
    OUTPUT "Please log in"
END IF

How Many Rows in a Truth Table?

A truth table with n inputs has 2ⁿ rows. Two inputs → 4 rows (2²). Three inputs → 8 rows (2³).

Exam tip: OCR J277 most commonly tests: (1) completing truth tables for AND, OR, NOT, and combinations like A AND NOT B; (2) explaining what each operator does in plain English; (3) evaluating Boolean expressions with given values. The fastest way to check AND: only one row is True (all inputs = 1). OR: only one row is False (all inputs = 0). NOT: just flip it.
⚠️ Common Mistakes
  • Confusing AND with OR — AND needs ALL True; OR needs AT LEAST ONE True
  • Forgetting NOT only takes ONE input (it's a unary operator)
  • Evaluating expressions in wrong order — NOT first, then AND, then OR
  • NOT writing 0 and 1 (or True/False) consistently in truth tables — use one system throughout
  • Missing rows in a truth table — 2 inputs = 4 rows, always
✅ Notes completed!
Video coming soon
Click slide or press arrow keys to navigate

Worksheet — 2.4.1a Boolean Logic

8 questions · 24 marks

Q1Describe the function of each Boolean operator: AND, OR, NOT.[3]
✅ Mark scheme
AND: outputs True only when ALL inputs are True [1]. OR: outputs True when AT LEAST ONE input is True [1]. NOT: inverts a single input — True becomes False, False becomes True [1].
Q2Complete the truth table for A OR B.[4]
✅ Mark scheme
A=0,B=0 → 0 [1]; A=0,B=1 → 1 [1]; A=1,B=0 → 1 [1]; A=1,B=1 → 1 [1]. OR is False only when BOTH inputs are 0.
Q3Complete the truth table for A AND B.[4]
✅ Mark scheme
A=0,B=0 → 0 [1]; A=0,B=1 → 0 [1]; A=1,B=0 → 0 [1]; A=1,B=1 → 1 [1]. AND is True only when BOTH inputs are 1.
Q4Evaluate: (a) 1 AND 0 (b) 1 OR 0 (c) NOT 1 (d) 0 AND (NOT 0)[4]
✅ Mark scheme
(a) 1 AND 0 = 0 [1] (both must be 1). (b) 1 OR 0 = 1 [1] (at least one is 1). (c) NOT 1 = 0 [1] (invert). (d) NOT 0 = 1; 0 AND 1 = 0 [1] (evaluate NOT first).
Q5Complete the truth table for A AND NOT B (include NOT B column).[4]
✅ Mark scheme
A=0,B=0: NOT B=1, result=0 [1]. A=0,B=1: NOT B=0, result=0 [1]. A=1,B=0: NOT B=1, result=1 [1]. A=1,B=1: NOT B=0, result=0 [1]. Result is 1 only when A=1 and B=0.
Q6How many rows are in a truth table with 3 inputs? Explain your answer.[2]
✅ Mark scheme
8 rows [1]. With n inputs there are 2ⁿ combinations. 3 inputs → 2³ = 8 rows (000, 001, 010, 011, 100, 101, 110, 111) [1].
Q7A login system grants access if: username is correct AND (password is correct OR PIN is correct). Write this as a Boolean expression using A = username correct, B = password correct, C = PIN correct.[1]
✅ Mark scheme
A AND (B OR C) [1]. The brackets ensure OR is evaluated first (B OR C), then AND with A. Without brackets, AND would be evaluated before OR.
Q8A = True, B = False. Evaluate: (a) A AND B (b) A OR B (c) NOT A (d) A AND NOT B[2]
✅ Mark scheme
(a) True AND False = False [½]. (b) True OR False = True [½]. (c) NOT True = False [½]. (d) NOT False = True; True AND True = True [½].
?
out of 24 — self-mark above
Topic Quiz
Question 1 of 15
You scored
out of 15
Card 1 of 8
Click to reveal definition
🎉
Complete!
TermDefinition
🎯

Mini Test — 2.4.1a Boolean Logic

10 questions · 10 marks · 10 minutes

← 2.3.2 Testing 2.4 Boolean Logic 2.4.1b Logic Circuits →