Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0478

Choose a basic data type

Select INTEGER, REAL, CHAR, STRING or BOOLEAN according to the value a variable must store.

Section 8 · Programming

Cambridge IGCSE Computer Science 0478 · Programming · 2026–2028 Version 6 · 8.1
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?

Put the idea to work

Worked example

Choose types for a member's name, average mark, active status and one-character grade.

Show the worked solution
  1. A name contains multiple characters, so use STRING.
  2. An average may have a fractional part, so use REAL.
  3. 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.

1 · Guided

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
  1. The value can contain a decimal fraction.
  2. INTEGER would discard that fraction.
  3. 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
2 · Independent

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
  1. CHAR stores a single character.
  2. It cannot store a multi-character response such as YES.
  3. 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
3 · Transfer

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
  1. INTEGER represents a quantity for calculation.
  2. Converting the phone number can remove the initial 0.
  3. 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
Recall without your notes

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.

Keep learning Computer Science

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 6 syllabus, with worked explanations and guided, independent and transfer practice. This is mapped teaching coverage, not proof of full exam readiness. Three earlier starter lessons remain available but are not counted as syllabus-mapped teaching. Practical programming experience in an executable browser workspace, full timed-paper practice, human subject-teacher review and the separate 2029–2031 syllabus remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.