Skip to content
Computing · Secondary 3

Active learning ideas

Debugging with Trace Tables

Active learning helps students grasp debugging because it shifts focus from abstract theory to concrete, observable steps. When students physically trace variables in a table, they see logic errors unfold in real time, making invisible processes visible. This hands-on practice builds confidence in identifying and fixing issues that compilers do not catch.

MOE Syllabus OutcomesMOE: Algorithms - S3
20–45 minPairs → Whole Class4 activities

Activity 01

Pair Trace Challenge: Bug Hunt

Provide pairs with a buggy algorithm printout and blank trace table. Partners alternate filling rows while explaining changes aloud, then swap to spot and fix the error. End with pairs presenting their corrected version to the class.

Analyze how a specific error in an algorithm manifests in a trace table.

Facilitation TipDuring Pair Trace Challenge, assign one student as the 'recorder' for the trace table while the other explains each step aloud to reinforce verbal reasoning.

What to look forProvide students with a short pseudocode snippet containing a logical error and a partially completed trace table. Ask them to complete the trace table and identify the line number causing the error, explaining their reasoning.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 02

Numbered Heads Together45 min · Small Groups

Small Group Stations: Error Types

Set up stations for loop errors, selection errors, and sequence errors, each with a unique algorithm. Groups trace one per station, note the bug in their table, and propose a fix before rotating. Debrief as a class.

Justify the steps taken to correct a logical error identified through tracing.

Facilitation TipIn Small Group Stations, provide a mix of correct and incorrect trace tables at each station so students must justify their choices before moving on.

What to look forPresent two trace tables for the same algorithm: one correct, one with a logical error. Ask students to compare the tables, identify the difference in variable states, and explain how this difference indicates the specific logical error.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 03

Numbered Heads Together20 min · Whole Class

Whole Class Algorithm Relay

Project an algorithm on the board. Students line up and take turns adding a trace table row, passing a marker. When inconsistency appears, the class discusses the bug and votes on the correction.

Differentiate between syntax errors and logical errors using trace table analysis.

Facilitation TipFor the Whole Class Algorithm Relay, use a timer to keep the activity moving but pause after each step to allow groups to ask clarifying questions.

What to look forGive students a simple algorithm and ask them to create a trace table. Then, pose a question: 'If the algorithm produced output X instead of the expected output Y, which variable in your trace table would you examine first and why?'

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 04

Numbered Heads Together25 min · Individual

Individual Practice: Error Logs

Give students worksheets with three algorithms at varying difficulty. They trace independently, log errors found, and rewrite fixed versions. Follow with peer review in pairs.

Analyze how a specific error in an algorithm manifests in a trace table.

Facilitation TipWhen reviewing Individual Practice: Error Logs, ask students to highlight the row where the logical error first appears, then annotate why it matters.

What to look forProvide students with a short pseudocode snippet containing a logical error and a partially completed trace table. Ask them to complete the trace table and identify the line number causing the error, explaining their reasoning.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach debugging by modeling your own thought process aloud when you encounter an error. Start with simple algorithms and gradually increase complexity, emphasizing how to read a trace table row by row. Avoid rushing to the solution; instead, ask students to predict what a variable’s value will be at each step before revealing it. Research suggests that students learn debugging best when they alternate between tracing and explaining, so build in frequent pauses for discussion.

By the end of these activities, students should reliably explain why a trace table’s values deviate from expected results and justify corrections with clear reasoning. They will also demonstrate the habit of testing multiple inputs, not just one, to ensure algorithms work broadly. Successful students will move from guessing errors to systematically analyzing trace data.


Watch Out for These Misconceptions

  • During Pair Trace Challenge, watch for students who assume the trace table should match their intuition rather than the actual algorithm steps.

    Circulate during Pair Trace Challenge and ask groups to explain each row’s logic aloud. If their reasoning contradicts the table, prompt them to re-examine the algorithm line by line to resolve the mismatch.

  • During Small Group Stations, students may believe that one correct test case proves an algorithm works.

    During Small Group Stations, require groups to test at least two different input sets and compare trace tables. If they skip edge cases, ask them to explain why the current test might not cover all scenarios.

  • During Whole Class Algorithm Relay, students may think variable values change arbitrarily within loops.

    During Whole Class Algorithm Relay, pause after each iteration to ask students to justify the variable update based on the loop’s condition. Use this to correct assumptions and reinforce predictable, rule-based changes.


Methods used in this brief