Trace Tables

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Trace Tables

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does each column in a trace table track one variable?
A No
B Yes
2. Does each row in a trace table represent one step?
A Yes
B No
3. Can trace tables help find logic errors?
A Yes
B No
4. Is a trace table a replacement for writing the algorithm?
A No
B Yes
5. Does x increase by 1 each loop pass in this example?
A No
B Yes

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Trace table AWrong - rows track steps, columns track variables
2Column BTracks one variable's changing value
3Represents one step of the algorithm CTrace table
4Helps find where an algorithm's logic goes wrong DWrong - a trace table checks the algorithm, not replaces it
5A trace table replaces writing the algorithm EA table that records each variable's value at every step
6Rows track variables, not steps FRow

Definitions

Trace table

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Each ______ tracks one variable
2.
Each ___ shows one step
3.
Trace tables help find logic ______
4.
x starts at _ in this algorithm
5.
x _________ by 1 each loop

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Rows never show steps
B Trace tables have columns
C Each column is one variable
Question 2
A Trace tables track values
B They never track loop steps
C They help spot logic errors
Question 3
A x starts at 1 here
B The loop runs while x <= 3
C x never changes value
Question 4
A Each row is one step
B Each column is one variable
C They're a manual technique
D Trace tables are always code
Question 5
A The loop checks x <= 3
B x increases by 1 each pass
C DISPLAY x shows the value
D x starts at 1 initially
E The loop runs forever

Answer Key

Trace Tables
Section A: Quick Questions
Q1
B — Yes
Q2
A — Yes
Q3
A — Yes
Q4
A — No
Q5
B — Yes
Section B: Match the Pairs
Q1
Trace table → A table that records each variable's value at every step
Q2
Column → Tracks one variable's changing value
Q3
Represents one step of the algorithm → Row
Q4
Helps find where an algorithm's logic goes wrong → Trace table
Q5
A trace table replaces writing the algorithm → Wrong - a trace table checks the algorithm, not replaces it
Q6
Rows track variables, not steps → Wrong - rows track steps, columns track variables
Section C: Definitions
Q1
Trace table — A table that records the value of each variable at every step of an algorithm, used to check its logic by hand.
Section D: Fill in the Blanks
Q1
Each column tracks one variable
Q2
Each row shows one step
Q3
Trace tables help find logic errors
Q4
x starts at 1 in this algorithm
Q5
x increases by 1 each loop
Section E: Spot the Error
Q1
A — Each row does show one step of the algorithm's execution.
Q2
B — Trace tables do track loop steps, one row at a time.
Q3
C — x changes value each loop, increasing by 1.
Q4
D — Trace tables are a technique for tracking values, not code itself.
Q5
E — The loop stops once x is greater than 3, not forever.