SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
AQA 8525 · Section 3.2 · 3.2.4/5

Relational & Boolean
Operators

Comparison Operators · AND / OR / NOT · Truth Tables

CSZoneAQA GCSE Computer Science 8525
Relational Operators

Comparing Values in AQA Pseudocode

OperatorMeaningExampleResult
=Equal to5 = 5True
Not equal to5 ≠ 3True
<Less than3 < 5True
>Greater than10 > 20False
<=Less than or equal5 <= 5True
>=Greater than or equal4 >= 7False
Boolean Operators

AND / OR / NOT in AQA Pseudocode

OperatorMeaningExample
ANDBoth conditions must be Trueage >= 18 AND hasID = True
ORAt least one condition must be Truecolour = 'red' OR colour = 'blue'
NOTReverses True/FalseNOT found
IF age >= 18 AND score >= 50 THEN
  OUTPUT 'Eligible'
ENDIF

IF day = 'Sat' OR day = 'Sun' THEN
  OUTPUT 'Weekend'
ENDIF
Truth Tables

AND / OR / NOT Truth Tables

AND
ABA AND B
TTT
TFF
FTF
FFF
OR
ABA OR B
TTT
TFT
FTT
FFF
NOT
ANOT A
TF
FT
AND:Both must be true. OR:At least one must be true. NOT:Flips the result.
Exam Practice

Have a go at this question

AQA-style question
What is the output of the following code when age = 20 and member = True?

IF age >= 18 AND NOT member THEN
  OUTPUT 'Pay full price'
ELSE
  OUTPUT 'Discount applied'
ENDIF
2 marks
age >= 18 → True. NOT member → NOT True → False. True AND False → False.
Output: 'Discount applied' [2]
Key Takeaways

What to Remember

Relational operators return True or False: = ≠ < > <= >=
AND — both true · OR — at least one true · NOT — reverses
AND is True only when both operands are True
Combine operators: (age >= 18 AND hasTicket = True)