← IGCSE Computer Science Paper 2

Basic data types in pseudocode

The five basic pseudocode data types: whole numbers, decimals, a single character, text of any length, and TRUE or FALSE. A phone number should be a STRING.

Understanding Basic data types in pseudocode in IGCSE Computer Science Paper 2

What it does: Phone numbers are identifiers, not quantities. STRING keeps the leading 0 and any + or spaces. REAL stores numbers with a fractional part. INTEGER would lose the pence. CHAR holds exactly one character. It is written in single quotes in pseudocode. BOOLEAN has only two values: TRUE and FALSE. Do not store them as text. This is the mistake because a CHAR variable cannot store text longer than one character. STRING is the type for text of any length.

Common mistakes: Age is an INTEGER, so it can only hold whole numbers. 15.5 has a fractional part. Use a whole number such as 15, or declare Age as REAL. Price is a REAL, so it needs a number. Quotes make "4.99" a STRING. It should be Price ← 4.99.

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 136–145) and word search (Modules 123–145).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which data type should store the number of students in a class, such as 28?
INTEGERREAL
Matches
DECLARE Grade : CHAR Grade ← "Merit"
↓
CHAR holds only one character, but "Merit" is several characters. Grade should be declared as STRING, or the value should be a single character such as "M".
Applying
Meanings
Term
INTEGER, REAL, CHAR, STRING, BOOLEAN
Meaning
The five basic pseudocode data types: whole numbers, decimals, a single character, text of any length, and TRUE or FALSE. A phone number should be a STRING.
Practice
DECLARE Age : INTEGER
Testing
Gaps
DECLARE Age :
Check Answer
Spots
2DECLARE Phone : STRING
3Age ← 15.5

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

The 'Giant Isopod' badge — Patient Builder, 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 data type should store the number of students in a class, such as 28?
A. INTEGER ✓
B. REAL
INTEGER stores whole numbers. A count of students is always a whole number.
2. Which data type should store a price such as 3.75?
A. INTEGER
B. REAL ✓
REAL stores numbers with a fractional part. INTEGER cannot hold the .75.
3. Which data type should store a single letter grade such as 'B'?
A. CHAR ✓
B. STRING
CHAR holds exactly one character. It is written in single quotes in pseudocode.
4. Which data type should store a name such as "Amira"?
A. STRING ✓
B. CHAR
STRING holds zero or more characters. A name is longer than one character, so CHAR is too small.
5. Which data type should store a value that can only be TRUE or FALSE, such as whether a door is locked?
A. STRING
B. BOOLEAN ✓
BOOLEAN has only two values: TRUE and FALSE. Do not store them as text.

Match the Pairs

DECLARE Age : INTEGER → Age can only store whole numbers, such as 15 or 42
DECLARE IsPassed : BOOLEAN → IsPassed can only store TRUE or FALSE
A phone number should be stored as text because it can start with 0 and is never used in calculations → DECLARE PhoneNumber : STRING
A price such as 4.99 has a fractional part, so it needs the type for decimal numbers → DECLARE Price : REAL
DECLARE Grade : CHAR Grade ← "Merit" → CHAR holds only one character, but "Merit" is several characters. Grade should be declared as STRING, or the value should be a single character such as "M".
DECLARE Score : INTEGER Score ← 72.5 → INTEGER cannot store a number with a fractional part like 72.5. Score should be declared as REAL, or the value should be a whole number.

Key Term

INTEGER, REAL, CHAR, STRING, BOOLEAN
The five basic pseudocode data types: whole numbers, decimals, a single character, text of any length, and TRUE or FALSE. A phone number should be a STRING.

Fill in the Blanks

1. DECLARE Age : INTEGER Age ← 15
Hint: Type the data type used for whole numbers with no fractional part.
2. DECLARE Price : REAL Price ← 2.75
Hint: Type the data type used for numbers that can have a fractional part.
3. DECLARE Grade : CHAR Grade ← 'A'
Hint: Type the data type that stores exactly one character.
4. DECLARE PhoneNumber : STRING PhoneNumber ← "0123456789"
Hint: Type the data type for text of any length. It suits a phone number because of the leading zero and because you never do sums with it.
5. DECLARE IsValid : BOOLEAN IsValid ← TRUE
Hint: Type the data type that can only hold TRUE or FALSE.

Spot the Error

Question 1
A DECLARE Age : INTEGER
B DECLARE Phone : STRING
C Age ← 15.5
Line C — Age is an INTEGER, so it can only hold whole numbers. 15.5 has a fractional part. Use a whole number such as 15, or declare Age as REAL.
Question 2
A DECLARE Price : REAL
B Price ← "4.99"
C OUTPUT Price
Line B — Price is a REAL, so it needs a number. Quotes make "4.99" a STRING. It should be Price ← 4.99.
Question 3
A DECLARE Grade : CHAR
B INPUT Grade
C Grade ← 'AB'
Line C — A CHAR holds exactly one character. 'AB' is two characters. Use one character such as 'A', or declare Grade as STRING.
Question 4
A DECLARE Phone : INTEGER
B Phone ← "07700900123"
C OUTPUT Phone
Line A — A phone number is not used for arithmetic and often starts with 0, which an INTEGER would lose. It should be declared as STRING.
Question 5
A DECLARE IsOpen : BOOLEAN
B DECLARE Count : INTEGER
C IsOpen ← "TRUE"
Line C — A BOOLEAN holds the values TRUE or FALSE without quotes. "TRUE" in quotes is a STRING. It should be IsOpen ← TRUE.

Student with a class code? Join your class →