← IGCSE Computer Science Paper 2

Telling literals of each type apart

How a literal is written shows its type: digits = INTEGER, decimal point = REAL, single quotes = CHAR, double quotes = STRING, TRUE or FALSE = BOOLEAN.

Understanding Telling literals of each type apart in IGCSE Computer Science Paper 2

What it does: "7" is in double quotes, so it is a STRING and not an INTEGER. Digits only with no decimal point is an INTEGER. A decimal point would make it REAL. The double quotes turn it into text. A BOOLEAN literal is written without quotes. Single quotes around one character make a CHAR, so '7' is a character and not a number.

Common mistakes: 15.0 has a decimal point, so it is a REAL literal. Age is an INTEGER, so it needs a whole number written with digits only: Age ← 15. Double quotes make "3.14" a STRING, not a number. Pi should be a REAL literal written with a decimal point and no quotes: CONSTANT Pi ← 3.14.

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 data type is the literal 7?
REALINTEGER
Matches
Flag ← "TRUE" // Flag is BOOLEAN
↓
"TRUE" in double quotes is a STRING, not a BOOLEAN. It should be written as TRUE with no quotes.
Applying
Meanings
Term
7 7.0 '7' "7" TRUE
Meaning
How a literal is written shows its type: digits = INTEGER, decimal point = REAL, single quotes = CHAR, double quotes = STRING, TRUE or FALSE = BOOLEAN.
Practice
DECLARE whole : INTEGER
Testing
Gaps
DECLARE Count :
Check Answer
Spots
1DECLARE Age : INTEGER
2Age ← 15.0

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

The 'Butterfly' badge — Branch Hopper, 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 is the literal 7?
A. INTEGER ✓
B. REAL
Digits only with no decimal point is an INTEGER. A decimal point would make it REAL.
2. Which data type is the literal 7.0?
A. INTEGER
B. REAL ✓
The decimal point makes 7.0 a REAL, even though its value is a whole number.
3. Which literal is a CHAR?
A. '7' ✓
B. "7"
Single quotes mean CHAR (one character). Double quotes mean STRING.
4. Which data type is the literal "7"?
A. CHAR
B. STRING ✓
Double quotes always make a STRING, even if it holds only one character.
5. Which literal is a BOOLEAN?
A. TRUE ✓
B. "TRUE"
TRUE with no quotes is a BOOLEAN. With double quotes it is just a STRING of four letters.

Match the Pairs

7.0 → A REAL literal, because it is written with a decimal point
'7' → A CHAR literal, because it is in single quotes
Double quotes around the characters make a STRING literal, even when they look like a number → "7"
TRUE written with no quotes is a BOOLEAN literal → TRUE
Flag ← "TRUE" // Flag is BOOLEAN → "TRUE" in double quotes is a STRING, not a BOOLEAN. It should be written as TRUE with no quotes.
Grade ← "A" // Grade is CHAR → "A" in double quotes is a STRING. A CHAR literal needs single quotes, so it should be 'A'.

Key Term

7 7.0 '7' "7" TRUE
How a literal is written shows its type: digits = INTEGER, decimal point = REAL, single quotes = CHAR, double quotes = STRING, TRUE or FALSE = BOOLEAN.

Fill in the Blanks

1. DECLARE Count : INTEGER Count ← 7
Hint: Type the data type that matches a whole number written with digits only.
2. DECLARE Price : REAL Price ← 7.0
Hint: Type the data type for a number written with a decimal point.
3. DECLARE Letter : CHAR Letter ← '7'
Hint: Type the data type for a single character written in single quotes.
4. DECLARE Word : STRING Word ← "TRUE"
Hint: Type the data type for text in double quotes, even if the text says TRUE.
5. DECLARE Done : BOOLEAN Done ← TRUE
Hint: Type the data type for a value that is TRUE or FALSE with no quotes.

Spot the Error

Question 1
A DECLARE Age : INTEGER
B Age ← 15.0
C OUTPUT Age
Line B — 15.0 has a decimal point, so it is a REAL literal. Age is an INTEGER, so it needs a whole number written with digits only: Age ← 15.
Question 2
A CONSTANT Pi ← "3.14"
B DECLARE Radius : REAL
C Radius ← 2.5
Line A — Double quotes make "3.14" a STRING, not a number. Pi should be a REAL literal written with a decimal point and no quotes: CONSTANT Pi ← 3.14.
Question 3
A CONSTANT IsOpen ← "TRUE"
B DECLARE Msg : STRING
C Msg ← "Open"
Line A — "TRUE" in double quotes is a STRING of four letters. The BOOLEAN literal is TRUE written with no quotes: CONSTANT IsOpen ← TRUE.
Question 4
A DECLARE Letter : CHAR
B DECLARE Word : STRING
C Letter ← "Q"
D Word ← "Quiz"
Line C — Double quotes make a STRING literal. A CHAR literal uses single quotes, so this should be Letter ← 'Q'.
Question 5
A DECLARE Price : REAL
B DECLARE Qty : INTEGER
C Qty ← 3
D Price ← '2.50'
Line D — Single quotes mean a CHAR, which holds only one character. A REAL literal has a decimal point and no quotes: Price ← 2.50.

Student with a class code? Join your class →