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

Declare variables and constants

Give changing data a clear name and protect fixed values with constants.

Cambridge IGCSE Computer Science 0984 · Programming · 2026–2028 Version 4 · 0984 (9–1) · 8.1
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. 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. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.

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

What does Score ← 0 do?

What you will learn

  • Declare a variable with a suitable data type
  • Assign and update a variable
  • Use a constant for a fixed literal value

A variable stores a value that may change

Declare a variable before using it, with a meaningful identifier and a data type. Assignment uses the left arrow: Score ← 0. A later assignment can replace the current value, such as Score ← Score + 1.

The identifier stays the same while its stored value can change. Choose a name that tells a reader what the value represents, such as AttemptsRemaining rather than X.

A constant records a fixed literal

Declare a constant with CONSTANT followed by its identifier and a literal value. Constants make rules easier to read and update, such as CONSTANT PassMark ← 50.

The syllabus pseudocode allows only a literal as the value assigned to a constant. Do not define one from a variable or calculation.

Pause and explain

Which is a valid constant declaration?

Put the idea to work

Worked example

A club charges the same hourly rate for every booking. Show a constant and calculate the charge for three hours.

Show the worked solution
  1. Store the fixed rate as CONSTANT HourlyRate ← 6.50.
  2. Declare Hours and Charge as REAL values if fractional amounts are possible.
  3. Assign Charge ← Hours * HourlyRate.

Answer CONSTANT HourlyRate ← 6.50; Charge ← 3 * HourlyRate, so Charge is 19.50.

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

Declare a whole-number variable for a learner's attempts and increase it by one.

Give me a hint

Use an INTEGER and assign the updated value back to the same name.

Compare my reasoning
  1. Declare Attempts : INTEGER.
  2. Set Attempts ← 0 before the first attempt.
  3. After an attempt, set Attempts ← Attempts + 1.

DECLARE Attempts : INTEGER; Attempts ← 0; Attempts ← Attempts + 1.

Look for these in your work

  • Meaningful identifier
  • Integer declared
  • Updated assignment
2 · Independent

A game has a fixed maximum score of 100. Show a suitable declaration and explain why it is a constant.

Give me a hint

The maximum does not change during the game.

Compare my reasoning
  1. Choose a clear name such as MaximumScore.
  2. Assign the literal 100 with CONSTANT.
  3. Use that identifier in checks instead of repeating 100.

CONSTANT MaximumScore ← 100, because the allowed maximum is fixed.

Look for these in your work

  • Literal assigned
  • Fixed value reason
3 · Transfer

A program uses X for the number of seats booked and later changes it to 4. Improve the identifier and explain what the assignment means.

Give me a hint

Name the value for the data it stores.

Compare my reasoning
  1. Rename X to SeatsBooked.
  2. Declare it as an INTEGER.
  3. Assign SeatsBooked ← 4 to store the current booking count.

Use SeatsBooked : INTEGER and assign SeatsBooked ← 4; the variable holds a value that may change.

Look for these in your work

  • Clear identifier
  • Suitable type
  • Assignment explained

Common mistakes

  • Using ← as a comparison instead of assignment
  • Changing a value that should be a constant
  • Using unclear identifiers such as A or Temp for permanent data
Recall without your notes

What can you explain now?

What is the main difference between a variable and a constant?

Compare with the explanation

A variable may be reassigned; a constant holds its declared literal

Variables can change as an algorithm runs; constants are fixed 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

When should a value be declared as a constant rather than a variable?

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 (9-1)

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 4 syllabus. Cambridge states that 0984 has the same subject content as 0478, with 9–1 grading. Three retained introductory lessons remain available but are not counted as syllabus-mapped teaching. The 2023–2025 syllabus remains unmapped. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. Practical programming in an executable browser workspace, full timed-paper practice and human subject-teacher review 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.