PseudoStudio TRACE TABLE HUB
PRACTICE TRACE TABLES →
DRY RUN ALGORITHMS CAMBRIDGE PAPER 2 EXAM STANDARD INSTANT GRID VERIFICATION

Trace Table Practice Questions for Cambridge IGCSE Computer Science

Practice trace table questions designed specifically for the Cambridge IGCSE (0478/0984) and A-Level (9618) Computer Science exams. Each question includes pseudocode with a trace table for you to complete, along with step-by-step worked answers. Use PseudoStudio's built-in compiler to run the pseudocode and verify your trace table answers instantly.

01 SELECT SYLLABUS ALIGNMENT
IGCSE Computer Science (0478/0984)
A-Level Computer Science (9618)
02 PRACTICE MODE
📊 Trace Table Dry Runs
03 SELECT ALGORITHM TYPES (CLICK TO TOGGLE)
Trace Tables & Loop Counters
FOR / WHILE Sentinel Loops
IF / ELSE Conditional Branches
1D Array Searches
Bubble & Insertion Sort Steps
String Substring Parsing
04 TRACE TABLE COMPLEXITY
Beginner (3 Variables, Single Loop)
Standard (4 Variables, Conditional Loop)
Advanced (Nested Loops & Arrays)
Paper 2 Exam Standard
05 NUMBER OF TRACE TABLES
3 Exercises
5 Exercises
8 Exercises
TRACE TABLE SESSION

Custom Dry Run Ready

IGCSE 0478/0984

20 Marks

ESTIMATED MARKS

15 Mins

TARGET TIME

2 TOPICS SELECTED
Trace Tables & Loop Counters FOR / WHILE Sentinel Loops

🔒 Free 1-click Google Sign-in to unlock and save progress

EXAM RULES

How Cambridge Trace Tables Work (Paper 2)

In Cambridge Computer Science exams, you are presented with a pseudocode algorithm and a blank trace table grid. Here is a live example of how values are recorded:

Total ← 0
FOR I ← 1 TO 3
    Total ← Total + (I * 2)
NEXT I
OUTPUT "Final Total:", Total
Iteration / Line I Total OUTPUT
Line 1 0
Loop Pass 1 (I=1) 1 2
Loop Pass 2 (I=2) 2 6
Loop Pass 3 (I=3) 3 12
Line 5 "Final Total: 12"
⚡ Solve Interactive Trace Table →
EXPERT METHOD

How to Answer Trace Table Questions

Completing a trace table accurately requires method and patience. Missing a single variable update can cause cascading errors. Follow these steps for Cambridge Computer Science exams (IGCSE 0478 and A-Level 9618):

  1. Read the entire code first: Understand the algorithm's purpose before tracing. Identify all variables and loops.
  2. Set up the columns: If not provided, create a column for every variable, condition, and output.
  3. Execute line by line: Follow the code exactly as a computer would. Do not skip steps.
  4. Record changes only: You only need to write a new value in a column when that variable's value changes. Use a dash (–) or leave it blank if the value remains the same as the previous step.
  5. Watch for loop conditions: Pay close attention to when a `WHILE` or `REPEAT...UNTIL` loop terminates.
  6. Track the exact OUTPUT: Ensure you record the output exactly as it would appear on screen, including strings and variables.
PRACTICE

Trace Table Practice Questions

Try solving these trace tables on paper first, then click "Show Answer" or run the code in PseudoStudio to verify.

Question 1: Simple FOR Loop (Easy)

Complete the trace table for the following algorithm.

DECLARE Num : INTEGER
DECLARE Total : INTEGER
Total ← 0
FOR Count ← 1 TO 3
    Num ← Count * 5
    Total ← Total + Num
NEXT Count
OUTPUT Total
👁️ Show Worked Answer
Count Num Total OUTPUT
--0-
155-
21015-
31530-
---30
▶ Run in PseudoStudio

Question 2: WHILE Loop with Condition (Medium)

Trace the following algorithm using the input values: 5, 8, -1.

DECLARE Value : INTEGER
DECLARE Max : INTEGER
Max ← 0
INPUT Value
WHILE Value <> -1 DO
    IF Value > Max THEN
        Max ← Value
    ENDIF
    INPUT Value
ENDWHILE
OUTPUT "Max is ", Max
👁️ Show Worked Answer
Value Max OUTPUT
-0-
5--
-5-
8--
-8-
-1--
--"Max is 8"
▶ Run in PseudoStudio

Question 3: Nested Loops & Arrays (Hard)

Complete the trace table for this algorithm. Assume the array Data[1:4] contains the values [3, 7, 2, 5].

DECLARE Temp : INTEGER
DECLARE Swapped : BOOLEAN
Swapped ← TRUE
WHILE Swapped = TRUE DO
    Swapped ← FALSE
    FOR i ← 1 TO 3
        IF Data[i] > Data[i+1] THEN
            Temp ← Data[i]
            Data[i] ← Data[i+1]
            Data[i+1] ← Temp
            Swapped ← TRUE
        ENDIF
    NEXT i
ENDWHILE
OUTPUT "Sorted"
👁️ Show Worked Answer

This is a classic Bubble Sort trace table. Only the first pass is shown below for brevity.

Swapped i Data[1] Data[2] Data[3] Data[4] Temp
TRUE-3725-
FALSE1-----
-2----7
---2---
----7--
TRUE------
-3----7
----5--
-----7-
▶ Run in PseudoStudio

Want to practice more? Generate unlimited custom trace tables instantly.

OPEN TRACE TABLE GENERATOR 🚀
FAQ

Trace Table Frequently Asked Questions

What is a trace table and why is it useful?
A trace table is a structured grid used to dry run an algorithm line-by-line manually. It helps programmers and exam students verify logic, track variable state changes, and locate logic errors (bugs) before running code on a computer.
Should I write a value in every single cell of a trace table?
No! In Cambridge mark schemes, you only write a value in a column when that variable's value actually changes on that step. Leaving cells blank when values do not change is standard exam practice.
How does PseudoStudio grade my trace table submission?
When you solve a trace table on PseudoStudio, our backend evaluates every cell in your grid against the exact step-by-step state matrix generated by running the interpreter. Correct cells turn green and incorrect cells turn red with helpful hints.
What are common trace table questions in IGCSE Computer Science exams?
Common IGCSE trace table questions include dry running FOR loops with counters, WHILE loops with sentinel values, IF/ELSE conditional branches, array searches, and sorting algorithms like Bubble Sort. You are typically given pseudocode and a blank trace table grid to complete.
How do I practice pseudocode trace tables effectively?
Start with simple FOR loop algorithms and work up to nested loops and arrays. Always read the entire algorithm first, set up columns for every variable, execute line-by-line, and record values only when they change. Use PseudoStudio's interactive trace table generator to verify your answers with instant automated feedback.
Where can I find pseudocode trace table questions with worked answers?
PseudoStudio provides free trace table practice questions with step-by-step worked answers right on this page. Each question includes runnable pseudocode you can verify in the compiler IDE. For a comprehensive walkthrough, read our How to Complete a Trace Table guide.
📊

Trace Table Generator

Paste any pseudocode and get an interactive trace table with auto-validation.

📖

Trace Table Guide

Full notes on dry-running pseudocode for IGCSE & A-Level exams.

📚

How to Complete a Trace Table

Step-by-step tutorial with 3 worked examples and rendered tables.