📁 Paper 1 · 3.2 Programming
3.2.4 & 3.2.5 Relational & Boolean Operators
AQA 8525 · GCSE Computer Science · ~10 min read
Notes
──
Video
──
Worksheet
──
Quiz

3.2.4 Relational Operators

Relational operators compare two values and return a Boolean result (True or False). They are used in conditions for IF, WHILE, and REPEAT…UNTIL.

OperatorMeaningExampleResult
==Equal to5 == 5True
!=Not equal to5 != 3True
<Less than3 < 7True
>Greater than7 > 3True
<=Less than or equal to5 <= 5True
>=Greater than or equal to4 >= 6False
age ← int(INPUT("Age: ")) IF age >= 18 THEN OUTPUT "Adult" ELSEIF age >= 13 THEN OUTPUT "Teenager" ELSE OUTPUT "Child" ENDIF

3.2.5 Boolean Operators

Boolean operators (logical operators) combine or negate Boolean values. AQA specifies AND, OR, and NOT.

OperatorMeaningRule
ANDBoth must be TrueTrue AND True → True; anything else → False
ORAt least one TrueFalse OR False → False; anything else → True
NOTReverses BooleanNOT True → False; NOT False → True

Truth Tables

ABA AND BA OR BNOT A
TrueTrueTrueTrueFalse
TrueFalseFalseTrueFalse
FalseTrueFalseTrueTrue
FalseFalseFalseFalseTrue

Combined Conditions

// AND — both conditions required IF age >= 18 AND hasID == True THEN OUTPUT "Entry granted" ENDIF // OR — either condition triggers it IF score < 0 OR score > 100 THEN OUTPUT "Invalid score" ENDIF // NOT — reverses the condition IF NOT (username == "admin") THEN OUTPUT "Access denied" ENDIF

Operator Precedence

When multiple operators appear together, the order matters: NOT → AND → OR (NOT has highest priority).

// NOT True AND False // = (NOT True) AND False // = False AND False = False

Use brackets to make complex conditions clear and unambiguous.

Exam tip: In truth tables, AND only gives True when BOTH inputs are True. OR gives False only when BOTH are False. These are the key patterns to memorise. De Morgan's Law: NOT(A AND B) = NOT A OR NOT B.
⚠️ Common Mistakes
  • Using = instead of == for comparison (= is assignment in AQA)
  • Confusing AND with OR — AND is stricter (both must be True)
  • Forgetting NOT reverses — NOT (5 > 3) = NOT True = False
  • Writing =! instead of != for "not equal to"
Video coming soon

Key points

  • Six relational operators: ==, !=, <, >, <=, >=
  • AND: both True; OR: at least one True; NOT: reversal
  • Truth tables for AND, OR, NOT
  • Combining operators in complex conditions
Click slide or press arrow keys to navigate
✍️

Worksheet — 3.2.4 & 3.2.5

8 questions · 22 marks

Q1Complete the truth table for AND and OR: A=True, B=False[2]
✅ Mark scheme
Mark scheme
A AND B = False [1]; A OR B = True [1].
Q2Evaluate: (a) NOT True (b) NOT (5 > 3) (c) NOT (10 == 9)[3]
✅ Mark scheme
Mark scheme
(a) False [1]; (b) False — 5>3 is True, NOT True = False [1]; (c) True — 10==9 is False, NOT False = True [1].
Q3Write a condition to check if a score is a valid percentage (0 to 100 inclusive).[2]
✅ Mark scheme
Mark scheme
score >= 0 AND score <= 100 [1 for each condition, 1 for AND — 2 marks].
Q4State the result of: (5 == 5) AND (3 != 3). Show your working.[2]
✅ Mark scheme
Mark scheme
(5==5) = True; (3!=3) = False; True AND False = False [2]. One mark if result wrong but working shows correct evaluation of components.
Q5Write pseudo-code to validate that age is between 16 and 18 inclusive. Output "Eligible" or "Not eligible".[3]
✅ Mark scheme
Mark scheme
IF age >= 16 AND age <= 18 THEN [2 — both conditions with AND]; OUTPUT "Eligible" ELSE OUTPUT "Not eligible" [1]; ENDIF.
Q6What is the difference between == and = in AQA pseudo-code?[2]
✅ Mark scheme
Mark scheme
== is a comparison operator that returns True/False [1]; = (or ←) is assignment that stores a value in a variable [1].
Q7Complete the full truth table for NOT A, A AND B, and A OR B for all 4 combinations of A and B.[4]
✅ Mark scheme
Mark scheme
T,T→NOT A=F,AND=T,OR=T [1]; T,F→NOT A=F,AND=F,OR=T [1]; F,T→NOT A=T,AND=F,OR=T [1]; F,F→NOT A=T,AND=F,OR=F [1].
Q8A login system requires username = "admin" AND password = "pass123". Write an IF statement to grant or deny access.[4]
✅ Mark scheme
Mark scheme
IF username == "admin" AND password == "pass123" THEN [2]; OUTPUT "Access granted" [1]; ELSE OUTPUT "Access denied" [1]; ENDIF.
Check your answers above.
Topic Quiz
Q 1 of 10
You scored
out of 10
Card 1 of 6
Click to flip
🎉
All done!
TermDefinition
🎯

Mini Test — 3.2.4/5 Operators

Timed exam conditions.

  • 8 questions · 10 minutes
  • 5 MCQ + 3 short answer
← 3.2.3 String Handling
15 of 57 · AQA 8525
3.2.6a Data Structures →