← IGCSE Computer Science Paper 2

Relational operators

Relational operators compare two values and give a BOOLEAN result (TRUE or FALSE). = equal, <> not equal, < less than, <= less or equal, > greater than, >= greater or equal.

Understanding Relational operators in IGCSE Computer Science Paper 2

What it does: < is strictly less than, so the boundary value 40 is not included. Using <= would make 40 give TRUE. In a condition, = compares two values for equality and gives TRUE or FALSE. It does not assign a value. Cambridge pseudocode uses <> for not equal. The symbol != belongs to languages such as Python. The operator >= means greater than OR equal to. 16 is equal to 16, so the result is TRUE. A mark of exactly 40 must pass, so you need >=. Using > would wrongly fail a mark of 40. <> means not equal. X is equal to 7, so 'X is not equal to 7' is FALSE.

Common mistakes: => is not a relational operator in pseudocode. 'Greater than or equal to' is written >=, so the line should be IF Age >= 18 THEN. Pseudocode uses <> for 'not equal to', not !=. The line should be IF Guess <> 7 THEN.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 146–155) and word search (Modules 146–165).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What type of value does the expression Score > 50 give?
BOOLEAN (TRUE or FALSE)INTEGER (a number)
Matches
IF Age != 18 THEN
↓
!= is not a pseudocode operator. 'Not equal to' is written <>, so it should be IF Age <> 18 THEN.
Applying
Meanings
Term
= < <= > >= <>
Meaning
Relational operators compare two values and give a BOOLEAN result (TRUE or FALSE). = equal, <> not equal, < less than, <= less or equal, > greater than, >= greater or equal.
Practice
Adult ← Age >= 18
Testing
Gaps
IF Mark 0 THEN
Check Answer
Spots
1INPUT Age
2IF Age => 18 THEN

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Peregrine Falcon' badge — Operator Ace, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What type of value does the expression Score > 50 give?
A. BOOLEAN (TRUE or FALSE) ✓
B. INTEGER (a number)
A relational operator compares two values and always gives a BOOLEAN result: TRUE or FALSE.
2. Which operator means 'not equal to' in IGCSE pseudocode?
A. <> ✓
B. !=
Cambridge pseudocode uses <> for not equal. The symbol != belongs to languages such as Python.
3. Age is 16. What does Age >= 16 give?
A. FALSE
B. TRUE ✓
The operator >= means greater than OR equal to. 16 is equal to 16, so the result is TRUE.
4. Age is 16. What does Age > 16 give?
A. TRUE
B. FALSE ✓
> means strictly greater than. 16 is not greater than 16, so the result is FALSE.
5. A pass mark is 40 or more. Which condition is correct?
A. Mark >= 40 ✓
B. Mark > 40
A mark of exactly 40 must pass, so you need >=. Using > would wrongly fail a mark of 40.

Match the Pairs

Age <> 18 → TRUE when Age is not equal to 18, otherwise FALSE
Score >= 50 → TRUE when Score is 50 or more, so 50 itself gives TRUE
Check that Mark is below 40 only, so a Mark of exactly 40 gives FALSE → Mark < 40
Check whether Password is exactly the same as the stored value Secret → Password = Secret
IF Age != 18 THEN → != is not a pseudocode operator. 'Not equal to' is written <>, so it should be IF Age <> 18 THEN.
IF Age < 18 THEN // must be 18 or over to vote → The boundary is wrong. A person aged exactly 18 should be allowed, so the test should be Age >= 18 and not Age < 18.

Key Term

= < <= > >= <>
Relational operators compare two values and give a BOOLEAN result (TRUE or FALSE). = equal, <> not equal, < less than, <= less or equal, > greater than, >= greater or equal.

Fill in the Blanks

1. IF Mark <> 0 THEN OUTPUT "Not zero" ENDIF
Hint: Type the relational operator that tests whether two values are not equal.
2. IsAdult ← Age > 17
Hint: Type the operator meaning strictly greater than, so 17 itself gives FALSE.
3. IF Age <= 12 THEN OUTPUT "Child" ENDIF
Hint: Type the operator that includes the boundary value 12 as well as smaller values.
4. IF Colour = "Red" THEN OUTPUT "Stop" ENDIF
Hint: Type the comparison operator for equal to, not the assignment arrow.
5. WHILE Count < 10 DO Count ← Count + 1 ENDWHILE
Hint: Type the operator that makes the loop stop before Count reaches the boundary value.

Spot the Error

Question 1
A INPUT Age
B IF Age => 18 THEN
C OUTPUT "Adult"
D ENDIF
Line B — => is not a relational operator in pseudocode. 'Greater than or equal to' is written >=, so the line should be IF Age >= 18 THEN.
Question 2
A INPUT Guess
B IF Guess != 7 THEN
C OUTPUT "Wrong"
D ENDIF
Line B — Pseudocode uses <> for 'not equal to', not !=. The line should be IF Guess <> 7 THEN.
Question 3
A INPUT Mark
B IF Mark > 50 THEN
C OUTPUT "50 or more: pass"
D ENDIF
Line B — Boundary error. A mark of exactly 50 should pass, but > excludes 50. It should be >= 50 so the boundary value is included.
Question 4
A INPUT Money
B Cost ← 5
C IF Money <= Cost THEN
D OUTPUT "Can buy"
E ENDIF
Line C — The operator points the wrong way. You can buy the item when Money is greater than or equal to Cost, so it should be IF Money >= Cost THEN.
Question 5
A WHILE Lives < 0 DO
B Lives ← Lives - 1
C ENDWHILE
D OUTPUT "Game over"
Line A — Lives is never less than 0 while the player is still alive, so the condition is FALSE at once and the loop never runs. It should be WHILE Lives > 0 DO.

Student with a class code? Join your class →