CSEC INFORMATION TECHNOLOGY · PROBLEM-SOLVING AND PROGRAMMING · LESSON C4

Trace Tables: Testing an Algorithm by Hand

How to build and read a trace table, with worked examples for a sequence, a decision and a loop, and how to use one to find a logic error.

Sections 7 and 87.7≈ 50 min🎮 3 games
Before you start

By the end of this lesson you can…

Step 1 · Watch

Explainer video

5 narrated scenes. Press play, listen and read along — the points appear as they are explained. Use ‹ Prev / Next › or the scene bar to jump to any scene.

LESSON C4 · EXPLAINER

Trace Tables: Testing an Algorithm by Hand

A trace table is a paper test: you play the computer, one line at a time. It is how you prove an algorithm works before you run it.

Narration uses your device’s built-in voice. No sound? Switch to “Captions only” — the captions advance on their own.

Explore in 3D

A trace table in 3D

Step through a loop and fill in the trace table.

Step 2 · Read

Key notes

Copy these into your notebook in your own words — that is how they stick.

Trace table

Records variable values step by step.

Columns

One per variable, plus condition and output.

Rows

One per step or per pass of a loop.

Test data

Use the values given; include a boundary.

Logic error

Program runs but gives a wrong answer.

Dry run

Testing by hand with a trace table.

Boundary value

Value exactly on a limit, e.g. 50.

Expected vs actual

Compare to find errors.

EXAM TIPS & COMMON MISTAKES

  • Include a column for EVERY variable and the output.
  • Write the value only when it changes; do not leave out loop passes.
  • Check boundary values (like exactly 50).
  • 4 marks in the SBA for a correct trace table.
Play & practise

Games

3 quick games on this lesson. Earn XP and badges as you play — your best score for each game is saved. Games are for practice and do not change your exam readiness. More games in the Information Technology Arcade.

Step 3 · Practise

Paper 1 practice — multiple choice

8 items modelled on real CSEC Paper 1 questions. Choose one answer for each, then check. Aim for 80% or better. Work each item on paper first.

Syllabus 7.7

1. A trace table is used to

Answer: B. Dry run.
Syllabus 7.7

2. The columns of a trace table represent

Answer: C. Variables, conditions, output.
Syllabus 7.7

3. After: a←4, b←6, c←a+b, the value of c is

Answer: A. 4+6.
Syllabus 7.7

4. For mark=50 with IF mark>=50, the result is

Answer: D. 50 ≥ 50 is true.
Syllabus 7.7

5. For count←1, sum←0, repeating while count<=3: sum←sum+count; count←count+1, the final sum is

Answer: B. 1+2+3.
Syllabus 7.7

6. A logic error is an error where the program

Answer: A. Logic error.
Syllabus 7.7

7. Testing with the values 49, 50 and 51 is testing

Answer: B. Around the limit.
Syllabus 7.7

8. Which finds an error by comparing expected and actual output?

Answer: C. Trace table.
Step 4 · Apply

Paper 2 practice — structured questions

Write full answers, then reveal the mark scheme and tick the points you earned (10 marks in total). Show all your working — method marks count. Your answers are saved on this device.

Paper 2 style · Trace table

Question 1 [10 marks]

Consider this algorithm: 1) count ← 1; 2) total ← 0; 3) WHILE count <= 4; 4) total ← total + count * 2; 5) count ← count + 1; 6) ENDWHILE; 7) OUTPUT total.

(a) (a) Complete a trace table with the columns count, total and output. [5]

MARK SCHEME — (a) (max 5)

(b) (b) State the output of the algorithm. [1]

MARK SCHEME — (b) (max 1)

(c) (c) State what a logic error is and how a trace table helps find one. [3]

MARK SCHEME — (c) (max 3)

(d) (d) Give one boundary value that would be used to test a program checking mark >= 50. [1]

MARK SCHEME — (d) (max 1)

Your progress

Lesson readiness

0%
READY
Not started
Video watched (20%)0%
Multiple choice (40%)0%
Structured (40%)0%

Sources

Where this topic appears in CSEC papers

Find these in your own past-paper booklets for extra timed practice. Items above are written in the style of these papers; any adapted from a specific question say so.