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

Complete a trace table for an algorithm

Dry-run instructions in order and record variable values, prompts and outputs at each step.

Section 7 · Algorithm design and problem-solving

Cambridge IGCSE Computer Science 0984 · Algorithm design and problem-solving · 2026–2028 Version 4 · 0984 (9–1) · 7
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers subject content Topic 7 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers 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

  • No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

If Count starts at 0 and Count ← Count + 1 runs, what is Count?

What you will learn

  • Record variable values after assignments
  • Track conditions and loop iterations
  • Document outputs and prompts in execution order

A trace table records changing state

A trace table documents a dry-run: start with the supplied inputs, follow each statement in order and record variable values whenever they change. Use one column per variable and label the point at which each row is recorded.

Apply and check the rule

Also record user prompts and outputs at the step where they occur. For a loop, make a new row for each iteration and evaluate the condition using the current values. A trace table is a simulation of the algorithm, not a rewritten explanation of what it should do.

Pause and explain

A loop body runs three times and displays a prompt each time. How many prompt outputs should be recorded?

Put the idea to work

Worked example

Trace Total ← 0; for each of 2, 5: Total ← Total + value; then output Total.

Show the worked solution
  1. Start Total=0.
  2. After value 2, Total=2.
  3. After value 5, Total=7; output 7.

Answer Total trace: 0 → 2 → 7; output 7.

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

Trace X ← 4; repeat twice: X ← X + 3; output X. Give each value and final output.

Give me a hint

Record the initial value and after each iteration.

Compare my reasoning
  1. Initial X=4.
  2. Iteration 1: X=7.
  3. Iteration 2: X=10; output 10.

X trace: 4 → 7 → 10; output 10.

Look for these in your work

  • Initial
  • Two updates
  • Output
2 · Independent

Trace a loop that starts Count=0 and repeats while Count<3, outputting Count before incrementing it. What values appear?

Give me a hint

Check the condition before each iteration.

Compare my reasoning
  1. At Count=0, output 0, then increment to 1.
  2. At Count=1, output 1; then 2.
  3. At Count=2, output 2; then Count becomes 3 and the loop stops.

Outputs: 0, 1, 2. Final Count=3.

Look for these in your work

  • Condition checks
  • Output timing
  • Stop condition
3 · Transfer

A trace table shows Total=12 after processing 3 and 4 from an initial Total=0. Identify a likely tracing or coding error.

Give me a hint

Add the two inputs independently.

Compare my reasoning
  1. Correct total is 0+3+4=7.
  2. 12 suggests a value was duplicated or the wrong variable was used.
  3. Recheck the assignment and one row at a time.

The total should be 7. Recheck whether an input was added twice or a stale variable was used.

Look for these in your work

  • Independent calculation
  • Discrepancy
  • Debug step

Common mistakes

  • Using an old variable value on the right side of an assignment
  • Omitting output until after a later statement changes the variable
Recall without your notes

What can you explain now?

What should a trace table show during an algorithm?

Compare with the explanation

The values and outputs as statements execute

It records the sequence of state changes in a dry-run.

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 belongs in a trace table when a loop changes variables and displays results?

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.