Dry Run Testing & Trace Tables

Learning Objectives


You have just completed a piece of code but when you run it, it does not behave as expected.

One way to check and troubleshoot your code is to perform a dry run using a trace table.

Trace tables are used by programmers to track the values of variables as they change throughout the program. This is useful when a program is not producing the desired result.

Context / Starter activity


A primary teacher likes to start her maths lesson by displaying a number sequence maths challenge on the board. Here are the last three challenges she has used with her class. Can you solve these?

Number Sequence #1:number-sequence-2
Number Sequence #2:number-sequence-3Number Sequence #3:number-sequence-1

The primary teacher decided to create some Python script to help them create similar number sequences.

Here is the pseudo-code for her first script:

To make sure her script is working she decided to complete a dry run test using a trace table. See animation below:
trace-table-s

View the complete trace table.

Challenge #1


Step 1: Complete the trace table for the following script:

Step 2: Implement this code using a high level programming language (e.g. Python) and compare your trace table with your actual output of your program.

Challenge #2


Step 1: Complete the trace table for the following script:

Step 2: Implement this code using a high level programming language (e.g. Python) and compare your trace table with your actual output of your program.

Challenge #3


Think of your own number sequences. Write the pseudo-code, the trace table and implement them using a high level programming language (e.g. Python).

Share Button
Posted in Computer Science, Computing Concepts
0 comments on “Dry Run Testing & Trace Tables
1 Pings/Trackbacks for "Dry Run Testing & Trace Tables"
  1. […] trace table is used┬áby a programmer to help simulate the running of a program. The programmer dry runs the […]

Our Latest Book

Follow this blog