How to Trace Algorithms and Dry Run Code in IGCSE Computer Science Paper 2

How to Trace Algorithms and Dry Run Code in IGCSE Computer Science Paper 2
How to Trace Algorithms and Dry Run Code in IGCSE Computer Science Paper 2

Last Updated: October 2026 | By EdFlik Education Team

For students studying Cambridge IGCSE Computer Science (0478 / 0984) or Pearson Edexcel International GCSE Computer Science (4CP0), Paper 2 is where abstract theory meets practical problem-solving. While Paper 1 tests your memorization of hardware, networks, and data storage, Paper 2 dives deep into computational thinking, programming, and algorithm design.

Among all the question types in Paper 2—ranging from pseudocode completion to trace tables—tracing algorithms and dry running code consistently proves to be the ultimate divider between Grade 4 and Grade 9 students. Examiners frequently award 4 to 8 marks for tracing complex loops, nested iterations, arrays, and 2D arrays. A single careless tracking error early in a trace table can cascade through subsequent rows and cost you an entire grade boundary.

In this comprehensive, exam-focused masterclass guide, our expert computer science educators break down the exact step-by-step methodology for dry running code, show you how to construct flawless trace tables, and reveal how to avoid the top traps that cost students marks.

Part 1: What is a "Dry Run" and Why Do Examiners Love It?

A dry run is the manual process of executing an algorithm line by line on paper without a computer, tracking how variables change values as the program runs.

Examiners test dry runs for three primary reasons:

  1. Logical Rigor: It tests whether you understand program control flow (sequence, selection, and iteration).
  2. Attention to Detail: It exposes whether you can track boundary conditions, such as loop termination checks and array index bounds.
  3. Debugging Mastery: A programmer who cannot manually trace code cannot effectively debug or write working code in Python, pseudocode, or Visual Basic.

Part 2: The Anatomy of an IGCSE Trace Table

When an exam question instructs you to "Complete the trace table for the given algorithm," you will be given a grid with column headers corresponding to each variable in the program, plus an extra column for output messages or console displays.

Step-by-Step Methodology for Tracing:

  1. Set Up Your Columns: List every variable declared in the algorithm as a column header in the exact order of initialization.
  2. Track Initialization: Write down the starting values assigned to variables before any loops or conditional statements execute.
  3. Execute Line-by-Line (Never Skip Steps): Follow the instruction pointer sequentially. When a variable changes value, cross out the old value (or write the new value directly in the next row) rather than erasing.
  4. Evaluate Boolean Conditions Carefully: For WHILE, FOR, or IF statements, write out the boolean evaluation (e.g., 5 < 10 evaluates to TRUE) before deciding whether to enter the loop body.
  5. Capture Output Explicitly: Whenever an OUTPUT, PRINT, or SEND TO DISPLAY command is executed, write the exact text or number in the output column.

Let us walk through a typical IGCSE Paper 2 trace table question involving arrays, loops, and conditional checks.

Exam-Style Pseudocode Snippet:

Plaintext

01  DECLARE Score : ARRAY[1:3] OF INTEGER
02  Score[1] <- 12
03  Score[2] <- 25
04  Score[3] <- 18
05  DECLARE Max : INTEGER
06  DECLARE Index : INTEGER
07  Max <- Score[1]
08  Index <- 1
09  FOR i <- 2 TO 3
10      IF Score[i] > Max THEN
11          Max <- Score[i]
12          Index <- i
13  ENDIF
14  NEXT i
15  OUTPUT "Highest score is ", Max, " at position ", Index

Step-by-Step Trace Execution:

  • Lines 01–06: Array Score is initialized with values [12, 25, 18]. Max is set to 12. Index is set to 1.
  • Iteration 1 (i = 2):
    • Check Line 10: Is Score[2] (25) $>$ Max (12)? TRUE.
    • Update Line 11: Max becomes 25.
    • Update Line 12: Index becomes 2.
  • Iteration 2 (i = 3):
    • Check Line 10: Is Score[3] (18) $>$ Max (25)? FALSE. (Values remain unchanged).
  • Loop Termination: The loop ends.
  • Line 15 Output: Highest score is 25 at position 2

Resulting Trace Table Structure:

iScore[1]Score[2]Score[3]MaxIndexOUTPUT
-122518121
2122518252
3122518252
Highest score is 25 at position 2

Part 4: Top 4 Traps That Cost IGCSE Computer Science Marks

  1. Miscounting Loop Boundaries (FOR vs. WHILE):
    • In a FOR i <- 1 TO 5 loop, remember that the loop executes for $i = 1, 2, 3, 4, 5$ (5 total iterations).
    • In a WHILE loop, students often forget to update the loop counter inside the loop body, leading to infinite loop confusion or missing the final termination check.
  2. Confusing Array Indexing (0-based vs. 1-based):
    • Cambridge IGCSE pseudocode standard uses 1-based indexing (e.g., Score[1] is the first element). Python uses 0-based indexing. Always check the array declaration bounds provided in the exam prompt (e.g., ARRAY[0:2] vs ARRAY[1:3]).
  3. Forgetting Variable Scope and Initialization: Failing to note when a variable is reset inside a nested loop versus when its value accumulates across iterations.
  4. Messy Handwriting in Trace Tables: Examiners cannot award marks if your numbers overlap or if it is impossible to determine which row a variable change belongs to. Keep your rows strictly aligned with a ruler if necessary.

Struggling with IGCSE Computer Science pseudocode, trace tables, or 2D array logic? EdFlik connects international school students globally with expert, 1-to-1 online computer science tutors, helping you master programming fundamentals and secure top $A^$ grades.*Book a Free Demo Class Today!

Frequently Asked Questions (FAQs)

Q1: What is the difference between pseudocode and programming languages like Python in Paper 2?

Ans: Pseudocode is an informal, structured English-like way of describing an algorithm without strict syntax rules, whereas Python or Visual Basic requires precise syntax. Cambridge IGCSE Paper 2 uses standardized pseudocode (e.g., INPUT, OUTPUT, <-, CASE OF), which is detailed in the syllabus reference guide.

Q2: How should I correct a mistake in a trace table during an exam?

Ans: Neatly draw a single horizontal line through the incorrect value and write the correct value directly above or beside it. Do not scribble out the entire table, as examiners need to see your working process.

Q3: Are trace tables only used for loops?

Ans: No. Trace tables can test sequential code, subroutines (functions and procedures), parameter passing, string manipulation functions, and conditional branching (IF-THEN-ELSE and CASE statements).

Q4: How does EdFlik support IGCSE Computer Science students?

Ans: EdFlik connects international school students worldwide with vetted, expert 1-to-1 online computer science tutors specializing in Cambridge IGCSE, Edexcel, and IB MYP/DP curricula. Our personalized sessions focus on practical coding logic, trace table drills, and past-paper mastery.

Computer Science & Coding Tutor Dubai UAE 2026 — Python, Java, AP & IGCSE
Best Computer Science & Coding tutor in Dubai & UAE. Expert 1-on-1 lessons in Python, Java, IGCSE 0478, A-Level, and AP CS. From AED 60/hour. Free trial class.
Computer Science Tutor UAE 2026 — IGCSE, IB CS, A-Level and AP CSA Guide
Find the right Computer Science tutor in UAE 2026. IGCSE 0478, IB CS IA, A-Level 9618, AP CSA Java — why programming-competent tutors matter. EdFlik from AED 65.
IGCSE Computer Science | Programming & Systems | EdFlik
Complete IGCSE Computer Science guide. Learn programming, algorithms, data representation, digital systems. Master coding and achieve top grades in IGCSE computer science.
A-Level Computer Science: Ace NEA Coursework & Theory Papers (2026)
Learn how to score high in A-Level Computer Science with expert NEA coursework strategies, programming tips, and theory paper preparation for 2026.