Choose a basic data type
Select INTEGER, REAL, CHAR, STRING or BOOLEAN according to the value a variable must store.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding.
Before you begin
- Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
Can the number 4.75 be stored as an INTEGER without changing it?
What you will learn
- Distinguish the five basic data types
- Choose a compatible type for a problem
- Recognise how type affects valid values
Types describe the values a variable can hold
INTEGER stores whole numbers; REAL stores numbers that can include a fractional part. CHAR stores one character, while STRING stores zero or more characters.
BOOLEAN stores one of two logical values: TRUE or FALSE. Use it for conditions such as IsMember instead of storing words such as "yes" and "no" without a reason.
Choose a type from the requirement
A student's age is usually INTEGER, a measured temperature may be REAL, and an email address is STRING. A single initial can be CHAR when the requirement guarantees exactly one character.
Check the required range and meaning before choosing. A type that is too narrow can lose information; a text code with leading zeros should often remain STRING rather than become a number.
Pause and explain
A product code may be "0042" and is never calculated. Which type is usually safest?
Worked example
Choose types for a member's name, average mark, active status and one-character grade.
Show the worked solution
- A name contains multiple characters, so use STRING.
- An average may have a fractional part, so use REAL.
- An active flag has two states, so use BOOLEAN; one grade symbol uses CHAR.
Answer Name : STRING; AverageMark : REAL; IsActive : BOOLEAN; Grade : CHAR.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Choose a type for a distance that may be 12.6 kilometres and explain your choice.
Give me a hint
Ask whether a fractional part is possible.
Compare my reasoning
- The value can contain a decimal fraction.
- INTEGER would discard that fraction.
- Choose REAL.
Use REAL because a distance such as 12.6 includes a fractional part.
Look for these in your work
- Fractional value noticed
- REAL chosen
A user enters a one-letter menu choice. Choose the narrowest suitable type and state one limitation.
Give me a hint
The requirement guarantees exactly one character.
Compare my reasoning
- CHAR stores a single character.
- It cannot store a multi-character response such as YES.
- Use STRING if the input length is not guaranteed.
Use CHAR for one guaranteed character; use STRING if longer input is possible.
Look for these in your work
- CHAR selected
- Limitation explained
A phone number begins with 0 and is displayed but never used in arithmetic. Explain why STRING may be safer than INTEGER.
Give me a hint
Consider what numeric conversion does to leading zeros.
Compare my reasoning
- INTEGER represents a quantity for calculation.
- Converting the phone number can remove the initial 0.
- STRING preserves the digits as entered and displayed.
Store it as STRING because it is an identifier; preserving the leading zero matters more than arithmetic.
Look for these in your work
- Identifier recognised
- Leading zero preserved
Common mistakes
- Choosing INTEGER for a value that can have decimals
- Treating a text identifier with leading zeros as arithmetic data
- Confusing CHAR with a multi-character STRING
What can you explain now?
Which type is suitable for the value TRUE or FALSE?
Compare with the explanation
BOOLEAN
BOOLEAN represents logical truth values.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
What question helps you decide between INTEGER and REAL?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.