← IGCSE Computer Science Paper 2

Relational operators: <, <=, > and >=

Relational operators that compare the size of two values and give TRUE or FALSE. < and > leave out the boundary value; <= and >= include it, so 50 >= 50 is TRUE but 50 > 50 is FALSE.

Understanding Relational operators: <, <=, > and >= in IGCSE Computer Science Paper 2

What it does: <= gives TRUE when Mark is 100, because it includes the boundary. < would reject 100. >= means greater than OR equal to. 50 is equal to 50, so the condition is TRUE. > only accepts values strictly bigger than 50. 50 is not bigger than itself, so the result is FALSE. < leaves out the boundary. Only ages 17 and below make Age < 18 TRUE. <= includes the boundary value 18, but < does not. A score of exactly 50 should pass, so you need >= to include the boundary. Using > would wrongly fail a score of 50.

Common mistakes: There is no => operator in pseudocode. 'Greater than or equal to' is written >= (the > comes first). The line should be IF Score >= 50 THEN. <= includes the boundary, so an 18-year-old would be told 'Under 18'. Under 18 means strictly less than 18, so use <. The line should be IF Age < 18 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 358–368) and word search (Modules 358–378).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Score <- 50. What does Score >= 50 give?
TRUE, because >= includes the boundary value 50FALSE, because 50 is not greater than 50
Matches
IF Score => 50 THEN
↓
The operator is written the wrong way round. Cambridge pseudocode uses >=, not =>.
Applying
Meanings
Term
< <= > >=
Meaning
Relational operators that compare the size of two values and give TRUE or FALSE. < and > leave out the boundary value; <= and >= include it, so 50 >= 50 is TRUE but 50 > 50 is FALSE.
Practice
Score <- 50
Testing
Gaps
IF Score 50 THEN
Check Answer
Spots
3Pass <- FALSE
4IF Score => 50 THEN

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

The 'Woodland Hedgehog' badge — Import Master, 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. Score <- 50. What does Score >= 50 give?
A. FALSE, because 50 is not greater than 50
B. TRUE, because >= includes the boundary value 50 ✓
>= means greater than OR equal to. 50 is equal to 50, so the condition is TRUE.
2. Score <- 50. What does Score > 50 give?
A. FALSE, because > leaves out the boundary value ✓
B. TRUE, because 50 is the same as 50
> only accepts values strictly bigger than 50. 50 is not bigger than itself, so the result is FALSE.
3. Age <- 18. What does Age < 18 give?
A. TRUE, because 18 is close to 18
B. FALSE, because 18 is not less than 18 ✓
< leaves out the boundary. Only ages 17 and below make Age < 18 TRUE.
4. Which condition is TRUE for a student who is exactly 18 years old (Age <- 18)?
A. Age <= 18 ✓
B. Age < 18
<= includes the boundary value 18, but < does not.
5. Which condition correctly tests for a pass mark when 50 or more is a pass?
A. Score >= 50 ✓
B. Score > 50
A score of exactly 50 should pass, so you need >= to include the boundary. Using > would wrongly fail a score of 50.

Match the Pairs

Score >= 50 → TRUE when Score is 50 or more, so a Score of exactly 50 is included
Age < 18 → TRUE only when Age is less than 18, so an Age of exactly 18 is not included
To include the boundary value 100 when checking the largest allowed mark, use 'less than or equal to' → Mark <= 100
To test that a value is strictly above the boundary, so 50 itself gives FALSE, use 'greater than' → Score > 50
IF Score => 50 THEN → The operator is written the wrong way round. Cambridge pseudocode uses >=, not =>.
IF Age < 18 THEN // 18 should be included → The < operator leaves out 18, so a person aged exactly 18 gives FALSE. To include 18, use <=.

Key Term

< <= > >=
Relational operators that compare the size of two values and give TRUE or FALSE. < and > leave out the boundary value; <= and >= include it, so 50 >= 50 is TRUE but 50 > 50 is FALSE.

Fill in the Blanks

1. IF Score >= 50 THEN OUTPUT "Pass" ENDIF
Hint: Type the operator meaning greater than or equal to, so a score of exactly 50 passes.
2. IF Age < 18 THEN OUTPUT "Under 18" ENDIF
Hint: Type the operator meaning less than, so 18 itself is not included.
3. Result <- 50 <= 50 OUTPUT Result
Hint: Type the operator meaning less than or equal to, which includes the boundary value so the result is TRUE.
4. WHILE Lives > 0 DO Lives <- Lives - 1 ENDWHILE
Hint: Type the operator meaning strictly greater than, so the loop stops when Lives reaches the boundary value 0.
5. Adult <- Age >= 18 OUTPUT Adult
Hint: Type the operator that includes the boundary, so an Age of exactly 18 gives TRUE.

Spot the Error

Question 1
A DECLARE Score : INTEGER
B INPUT Score
C Pass <- FALSE
D IF Score => 50 THEN
E Pass <- TRUE
F ENDIF
Line D — There is no => operator in pseudocode. 'Greater than or equal to' is written >= (the > comes first). The line should be IF Score >= 50 THEN.
Question 2
A DECLARE Age : INTEGER
B INPUT Age
C IF Age <= 18 THEN
D OUTPUT "Under 18"
E ENDIF
Line C — <= includes the boundary, so an 18-year-old would be told 'Under 18'. Under 18 means strictly less than 18, so use <. The line should be IF Age < 18 THEN.
Question 3
A DECLARE Mark : INTEGER
B INPUT Mark
C OUTPUT "Pass mark is 50"
D IF Mark > 50 THEN
E OUTPUT "Pass"
F ENDIF
Line D — The pass mark is 50, so a mark of exactly 50 must pass. > leaves out 50 (50 > 50 is FALSE). Use >= to include the boundary: IF Mark >= 50 THEN.
Question 4
A INPUT Temp
B IF Temp =< 0 THEN
C OUTPUT "Freezing"
D ENDIF
Line B — The symbols are in the wrong order. 'Less than or equal to' is written <=, not =<. The line should be IF Temp <= 0 THEN.
Question 5
A DECLARE Age : INTEGER
B INPUT Age
C IF Age <= 18 THEN
D OUTPUT "Adult"
E ENDIF
Line C — The comparison points the wrong way. Adults are aged 18 or MORE, so the condition needs >=, not <=. The line should be IF Age >= 18 THEN.

Student with a class code? Join your class →