← IGCSE Computer Science Paper 2

Logical operator NOT

A logical operator that reverses a condition: NOT TRUE is FALSE and NOT FALSE is TRUE. For example, NOT (Score >= 50) is TRUE only when Score is below 50.

Understanding Logical operator NOT in IGCSE Computer Science Paper 2

What it does: The OUTPUT runs when Found is FALSE, because NOT FALSE is TRUE. NOT (Age = 18) and Age <> 18 are both TRUE when Age is anything other than 18. NOT reverses a Boolean value, so NOT TRUE gives FALSE and NOT FALSE gives TRUE. The opposite of 'greater than or equal to 50' is 'less than 50'. Score <= 50 would wrongly include 50 itself. NOT (Age = 18) is TRUE for every value except 18, which is exactly what <> means. Age < 18 misses ages above 18. NOT goes in front of the condition it reverses. It cannot be placed in the middle of a comparison.

Common mistakes: NOT is missing. Without it, Fail is TRUE when the score is 50 or more, which is the opposite of what is wanted. It should be Fail <- NOT (Score >= 50). An IF statement must have THEN after its condition. The line should be IF NOT (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
What is the value of NOT TRUE?
FALSETRUE
Matches
IF NOT Score >= 50 THEN OUTPUT "Fail" ENDIF
↓
The condition Score >= 50 is not in brackets, so it is unclear what NOT applies to. It should be NOT (Score >= 50).
Applying
Meanings
Term
NOT
Meaning
A logical operator that reverses a condition: NOT TRUE is FALSE and NOT FALSE is TRUE. For example, NOT (Score >= 50) is TRUE only when Score is below 50.
Practice
IF NOT (Score >= 50)
Testing
Gaps
IF (Score >= 50) THEN
Check Answer
Spots
3INPUT Score
4Fail <- (Score >= 50)

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

The 'Jellyfish' badge — Flow Controller, 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 is the value of NOT TRUE?
A. TRUE
B. FALSE ✓
NOT reverses a Boolean value, so NOT TRUE gives FALSE and NOT FALSE gives TRUE.
2. Score is 62. What does NOT (Score >= 50) evaluate to?
A. FALSE ✓
B. TRUE
Score >= 50 is TRUE for 62, and NOT reverses it to FALSE.
3. Score is 35. What does NOT (Score >= 50) evaluate to?
A. TRUE ✓
B. FALSE
Score >= 50 is FALSE for 35, and NOT reverses it to TRUE. So NOT (Score >= 50) is TRUE only when Score is below 50.
4. Found is a BOOLEAN variable set to FALSE. What is NOT Found?
A. FALSE
B. TRUE ✓
Found is FALSE, so NOT Found reverses it to TRUE.
5. Which condition means the same as NOT (Score >= 50)?
A. Score < 50 ✓
B. Score <= 50
The opposite of 'greater than or equal to 50' is 'less than 50'. Score <= 50 would wrongly include 50 itself.

Match the Pairs

NOT (Score >= 50) → TRUE only when Score is below 50, because NOT reverses the condition
NOT Found → TRUE when the BOOLEAN variable Found holds FALSE
NOT reverses a condition, so NOT FALSE gives TRUE → IF NOT Found THEN OUTPUT "Not found" ENDIF
NOT (Age = 18) does the same job as the not-equal operator <> → IF Age <> 18 THEN OUTPUT "Not 18" ENDIF
IF NOT Score >= 50 THEN OUTPUT "Fail" ENDIF → The condition Score >= 50 is not in brackets, so it is unclear what NOT applies to. It should be NOT (Score >= 50).
IF NOT (Score >= 50) THEN OUTPUT "Pass" ENDIF → NOT (Score >= 50) is TRUE for scores below 50, so the message should be Fail, not Pass.

Key Term

NOT
A logical operator that reverses a condition: NOT TRUE is FALSE and NOT FALSE is TRUE. For example, NOT (Score >= 50) is TRUE only when Score is below 50.

Fill in the Blanks

1. IF NOT (Score >= 50) THEN OUTPUT "Resit needed" ENDIF
Hint: Type the logical operator that reverses the condition in the brackets.
2. IF NOT Found THEN OUTPUT "Keep searching" ENDIF
Hint: Type the BOOLEAN variable being reversed. It records whether a search succeeded.
3. Same ← NOT (Age = 18) Same2 ← Age <> 18
Hint: Type the single relational operator that gives the same result as NOT with =
4. Pass ← NOT (Score < 50) OUTPUT Pass
Hint: Type the relational operator so that Pass is TRUE when Score is 50 or more.
5. Result ← NOT FALSE OUTPUT Result
Hint: Type the BOOLEAN value that NOT reverses to make Result TRUE.

Spot the Error

Question 1
A DECLARE Score : INTEGER
B DECLARE Fail : BOOLEAN
C INPUT Score
D Fail <- (Score >= 50)
E OUTPUT Fail
Line D — NOT is missing. Without it, Fail is TRUE when the score is 50 or more, which is the opposite of what is wanted. It should be Fail <- NOT (Score >= 50).
Question 2
A IF NOT (Age >= 18)
B OUTPUT "Minor"
C ENDIF
Line A — An IF statement must have THEN after its condition. The line should be IF NOT (Age >= 18) THEN.
Question 3
A DECLARE Found : BOOLEAN
B Found <- FALSE
C OUTPUT "Searching..."
D IF Found NOT THEN
E OUTPUT "Not found"
F ENDIF
Line D — NOT is a prefix operator, so it goes before the value it reverses. The line should be IF NOT Found THEN.
Question 4
A DECLARE Found : BOOLEAN
B Found = FALSE
C IF NOT Found THEN
D OUTPUT "Missing"
E ENDIF
Line B — = is a comparison, not assignment. Cambridge pseudocode assigns with <-, so the line should be Found <- FALSE.
Question 5
A DECLARE Answer : STRING
B INPUT Answer
C IF NOT (Answer <> "Y") THEN
D OUTPUT "Not yes"
E ENDIF
Line C — NOT reverses <>, so NOT (Answer <> "Y") means the same as Answer = "Y". The message would show for a Y. Use NOT (Answer = "Y") or just Answer <> "Y".

Student with a class code? Join your class →