Tracking variable values on paper

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

Tracking variable values on paper

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A tracking table has one column for each ___.
A variable
B line of text
2. What does each row of a tracking table show after a loop?
A The name of the programmer
B The values after one repeat
3. Where do the starting values go in a tracking table?
A In the last row
B In the first row
4. An algorithm has the variables score and lives. How many columns does the tracking table need?
A 2 columns, one for score and one for lives
B 1 column, because they go together
5. The algorithm starts with count = 0, then REPEAT 3 TIMES: ADD 2 to count. What is count in the row after the second repeat?
A 4
B 2

Match the Pairs

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

Left columnRight column
1| repeat | score | lives | AThe header row of a tracking table: one column for each variable, here score and lives, plus a column for the repeat number
2| start | 0 | 3 | B| repeat | coins | steps |
3Each time the loop repeats, you add a new row to the tracking table to show the new values C| repeat 1 | 2 | | repeat 2 | 4 | | repeat 3 | 6 |
4Each variable gets its own column, so a table for a loop that uses coins and steps needs two value columns DThe first row of a tracking table, which holds the starting values of the variables before any repeat happens
5| repeat | score | score + 1 | EThe second column is an action, not a variable. A column should be named after a variable, such as lives or count, not a calculation.
6| repeat 1 | 1 | (first row, before the loop starts) FThe first row should hold the starting values before any repeat. Here it shows the value after the first repeat, so the starting value is missing.

Definitions

tracking table

Fill in the Blanks

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

1.
SET lives TO 3 SET coins TO 0 Table columns: lives, _____
2.
SET count TO 0 REPEAT 3 TIMES: ADD 2 TO count Row 1 (start): count = _
3.
REPEAT 4 TIMES ADD 1 TO score Repeat rows needed in table: _
4.
SET total TO 10 SUBTRACT 3 FROM total Row 2 (after one repeat): total = _
5.
REPEAT UNTIL count = 3 Each repeat of the loop adds a new ___

Spot the Error

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

Question 1
A Add 2 to total each repeat
B Start: count=0 total=0
C Repeat 1: count=1 total=2
D Repeat 2: count=2 total=5
E Repeat 3: count=3 total=6
Question 2
A Each repeat: lives-1, coins+5
B Start | lives 3 | coins 0
C Repeat 1 | lives 2 | coins 10
D Repeat 2 | lives 1 | coins 10
Question 3
A SET total TO 5
B REPEAT 3 TIMES
C ADD 5 TO total
D Table: total 0, 5, 10, 15
Question 4
A One row for each variable
B One row for each repeat
C First row: the starting values
Question 5
A n starts at 1 and doubles
B Start: n=1
C Repeat 1: n=2
D Repeat 2: n=6
E Repeat 3: n=8

Answer Key

Tracking variable values on paper
Section A: Quick Questions
Q1
A — variable
Q2
B — The values after one repeat
Q3
B — In the first row
Q4
A — 2 columns, one for score and one for lives
Q5
A — 4
Section B: Match the Pairs
Q1
| repeat | score | lives | → The header row of a tracking table: one column for each variable, here score and lives, plus a column for the repeat number
Q2
| start | 0 | 3 | → The first row of a tracking table, which holds the starting values of the variables before any repeat happens
Q3
Each time the loop repeats, you add a new row to the tracking table to show the new values → | repeat 1 | 2 | | repeat 2 | 4 | | repeat 3 | 6 |
Q4
Each variable gets its own column, so a table for a loop that uses coins and steps needs two value columns → | repeat | coins | steps |
Q5
| repeat | score | score + 1 | → The second column is an action, not a variable. A column should be named after a variable, such as lives or count, not a calculation.
Q6
| repeat 1 | 1 | (first row, before the loop starts) → The first row should hold the starting values before any repeat. Here it shows the value after the first repeat, so the starting value is missing.
Section C: Definitions
Q1
tracking table — A table with a column for each variable and a row for each step or repeat. It shows how the values change, and the first row holds the starting values.
Section D: Fill in the Blanks
Q1
SET lives TO 3 SET coins TO 0 Table columns: lives, coins
Q2
SET count TO 0 REPEAT 3 TIMES: ADD 2 TO count Row 1 (start): count = 0
Q3
REPEAT 4 TIMES ADD 1 TO score Repeat rows needed in table: 4
Q4
SET total TO 10 SUBTRACT 3 FROM total Row 2 (after one repeat): total = 7
Q5
REPEAT UNTIL count = 3 Each repeat of the loop adds a new row
Section E: Spot the Error
Q1
D — The rule adds 2 each repeat. After repeat 1 the total is 2, so after repeat 2 it must be 4, not 5.
Q2
C — Coins go up by 5 each repeat. After repeat 1, coins should be 5, not 10. Each row shows how the values change from the row before.
Q3
A — The first row of the table holds the starting value, which is 0. The algorithm must start with SET total TO 0 so the table matches.
Q4
A — A tracking table has one column for each variable. The rows are for the steps or repeats, not the variables.
Q5
D — n doubles each repeat. After repeat 1 n is 2, so after repeat 2 it is 2 x 2 = 4, not 6.