← IGCSE Computer Science Paper 2

BOOLEAN data type

A data type with only two possible values, TRUE or FALSE, written without quotes. Used for yes/no information, e.g. DECLARE GameOver : BOOLEAN

Understanding BOOLEAN data type in IGCSE Computer Science Paper 2

What it does: Yes/no information is stored in a BOOLEAN variable, which can only be TRUE (yes) or FALSE (no). Writing FALSE with no quotes assigns the BOOLEAN value. Quotes would make it a STRING instead. BOOLEAN is the Cambridge pseudocode data type for yes/no information. YESNO is not a data type.

Common mistakes: FALSE is a keyword, not a string. With quotes it becomes a STRING, which cannot be stored in a BOOLEAN. It should be GameOver ← FALSE. A BOOLEAN variable can only hold TRUE or FALSE. The number 1 is an INTEGER, so it must be Passed ← TRUE.

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 327–336) and word search (Modules 317–336).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which declaration correctly creates a variable that stores yes/no information?
DECLARE GameOver : YESNODECLARE GameOver : BOOLEAN
Matches
GameOver ← "TRUE"
↓
TRUE is in quotes, so it is a STRING and not a BOOLEAN value. It should be GameOver ← TRUE
Applying
Meanings
Term
BOOLEAN
Meaning
A data type with only two possible values, TRUE or FALSE, written without quotes. Used for yes/no information, e.g. DECLARE GameOver : BOOLEAN
Practice
DECLARE GameOver : BOOLEAN
Testing
Gaps
DECLARE GameOver :
Check Answer
Spots
1DECLARE GameOver : BOOLEAN
2GameOver ← "FALSE"

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

The 'Flamingo' badge — Balanced Coder, 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. Which declaration correctly creates a variable that stores yes/no information?
A. DECLARE GameOver : YESNO
B. DECLARE GameOver : BOOLEAN ✓
BOOLEAN is the Cambridge pseudocode data type for yes/no information. YESNO is not a data type.
2. How many different values can a BOOLEAN variable hold?
A. Two: TRUE and FALSE ✓
B. Any whole number
A BOOLEAN can only ever be TRUE or FALSE. Whole numbers are stored in INTEGER variables.
3. Which line assigns a BOOLEAN value correctly?
A. GameOver ← TRUE ✓
B. GameOver ← "TRUE"
TRUE and FALSE are keywords, so they are written without quotes. With quotes, "TRUE" is just a STRING.
4. Which statement about TRUE and FALSE is correct?
A. They must always be written in quotes
B. They are keywords, not strings ✓
TRUE and FALSE are BOOLEAN literals. Quotes would turn them into text and cause a data type mismatch.
5. Which piece of information is best stored in a BOOLEAN variable?
A. Whether the player has won (yes or no) ✓
B. The player's full name
A name is a STRING. Only yes/no information, such as won or not won, suits a BOOLEAN.

Match the Pairs

DECLARE GameOver : BOOLEAN → Creates a variable called GameOver that can only store TRUE or FALSE
GameOver ← TRUE → Stores the BOOLEAN value TRUE in GameOver, for example to show the game has ended
A BOOLEAN variable can hold yes/no information, such as whether a player has finished the level → DECLARE LevelComplete : BOOLEAN
TRUE and FALSE are keywords, so they are written without quotes when assigned → GameOver ← FALSE
GameOver ← "TRUE" → TRUE is in quotes, so it is a STRING and not a BOOLEAN value. It should be GameOver ← TRUE
GameOver ← YES → YES is not a BOOLEAN value. A BOOLEAN can only be TRUE or FALSE, so use GameOver ← TRUE

Key Term

BOOLEAN
A data type with only two possible values, TRUE or FALSE, written without quotes. Used for yes/no information, e.g. DECLARE GameOver : BOOLEAN

Fill in the Blanks

1. DECLARE GameOver : BOOLEAN
Hint: Type the data type used for yes/no information that can only be one of two values.
2. GameOver ← FALSE
Hint: Type the Boolean keyword meaning the game has not ended yet. It is a keyword, so no quotes.
3. DECLARE IsRaining : BOOLEAN
Hint: Type the keyword that creates a new variable before it is used.
4. IF Lives = 0 THEN GameOver ← TRUE ENDIF
Hint: Type the Boolean keyword meaning yes, written without quotes.
5. DECLARE LoggedIn : BOOLEAN LoggedIn ← TRUE OUTPUT LoggedIn
Hint: Type the name of the Boolean variable whose value should be displayed.

Spot the Error

Question 1
A DECLARE GameOver : BOOLEAN
B GameOver ← "FALSE"
C IF GameOver = TRUE THEN
D OUTPUT "Game over"
E ENDIF
Line B — FALSE is a keyword, not a string. With quotes it becomes a STRING, which cannot be stored in a BOOLEAN. It should be GameOver ← FALSE.
Question 2
A DECLARE Passed : BOOLEAN
B DECLARE Score : INTEGER
C Score ← 72
D Passed ← 1
E OUTPUT Passed
Line D — A BOOLEAN variable can only hold TRUE or FALSE. The number 1 is an INTEGER, so it must be Passed ← TRUE.
Question 3
A DECLARE IsOpen : BOOLEAN
B IsOpen ← TRUE
C IF IsOpen = "TRUE" THEN
D OUTPUT "Open"
E ENDIF
Line C — TRUE must be written without quotes. "TRUE" is a string, not a BOOLEAN value. It should be IF IsOpen = TRUE THEN.
Question 4
A DECLARE Lives : INTEGER
B DECLARE Alive : BOOLEAN
C Alive ← Lives
D OUTPUT Alive
Line C — Lives is an INTEGER, so it cannot be assigned to a BOOLEAN variable. Use a comparison that gives TRUE or FALSE, such as Alive ← Lives > 0.
Question 5
A DECLARE Done : BOOLEAN
B Done = FALSE
C OUTPUT Done
Line B — Assignment uses the ← operator, not =. A line starting Done = FALSE is a comparison, not an assignment. It should be Done ← FALSE.

Student with a class code? Join your class →