Trace Tables Worksheet Generator
Short programs in TeachSpark pseudocode with a built-in interpreter. No AI, no credits.
Short programs in TeachSpark's own pseudocode (with a printed syntax key) using variables, loops and conditions. A small interpreter built into the tool runs each program to produce the exact trace table. Never uses AP or IB exam pseudocode names or text. No AI, so it never uses a generation credit.
What students practice
- Computer Science
- Trace tables
- Pseudocode
Live sample sheet
Trace Tables
SET x = 13 SET y = 9 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 7 SET sum = sum + i NEXT i OUTPUT sum
SET x = 17 SET y = 31 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 6 SET y = 13 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 6 SET sum = sum + i NEXT i OUTPUT sum
SET x = 20 SET y = 46 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 15 SET y = 7 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 1 TO 6 SET sum = sum + i NEXT i OUTPUT sum
Answer Key — Trace Tables
SET x = 13 SET y = 9 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 7 SET sum = sum + i NEXT i OUTPUT sum
SET x = 17 SET y = 31 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 6 SET y = 13 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 6 SET sum = sum + i NEXT i OUTPUT sum
SET x = 20 SET y = 46 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 15 SET y = 7 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 1 TO 6 SET sum = sum + i NEXT i OUTPUT sum
Assumptions and Conventions
- Programs use TeachSpark pseudocode, not AP or IB exam pseudocode.
- The interpreter runs each program step by step to produce the trace.
- Variables start as undefined (shown as —) until they are assigned a value.
- SET var = value — assign a value to a variable.
- IF condition THEN ... END IF — execute the block only if the condition is true.
- FOR i = start TO end ... NEXT i — repeat with i from start to end inclusive.
- OUTPUT value — print a value.
- Operators: + - * / and MOD (modulo), > < = >= <= <>
No account needed.
Frequently asked questions
Do students need an account to use the Trace Tables?
No. Students never need an account. They open a shared link or join with a code.
Can I print the Trace Tables without signing up?
Yes. This tool computes answers by code, so you can generate, preview and print worksheet without an account. A free account adds saving and student links.
How are the answers computed?
Every answer is computed by code and verified by a second independent method. No AI is used.
What grades is the Trace Tables for?
This tool fits Grades 6 – 12.
Related tools in Computer Science Studio
Number Systems
Binary, decimal, hexadecimal and octal conversions, binary addition and two's complement. No AI, no credits.
Logic Gates and Boolean Algebra
Truth tables, circuits drawn by code, and Boolean algebra. No AI, no credits.
Sorting and Searching Practice
Bubble, insertion and selection sort passes, and binary search steps. No AI, no credits.
Data Representation
Character codes, file sizes, hex colors and compression ratios. No AI, no credits.
Computer Science Reference Sheet
Powers of two, character code table, Boolean laws and pseudocode syntax key. No AI, no credits.
✓ No account needed to generate, preview and print. A free account adds saving and student links.
Sign inWhat can I do?
Without an account
- Generate sheets
- Preview pages
- Print or save as PDF
- Make versions A, B, C
- Make differentiated levels
- Print answer keys
- See the trust panel and Show the calculation
- Try the on-screen practice
- Report a problem
With a free account
- Save to My library
- Browse My library
- Share revocable student links
- Make QR codes
- Turn sharing on or off
Students never need an account — they open a shared link or join with a code.
Sample output, computed by code — change the options and Generate to make your own
Trace Tables
SET x = 20 SET y = 7 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 2 TO 8 SET sum = sum + i NEXT i OUTPUT sum
SET x = 30 SET y = 24 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 2 SET y = 16 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 8 SET sum = sum + i NEXT i OUTPUT sum
SET x = 28 SET y = 48 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 18 SET y = 20 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 2 TO 5 SET sum = sum + i NEXT i OUTPUT sum
Answer Key — Trace Tables
SET x = 20 SET y = 7 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 2 TO 8 SET sum = sum + i NEXT i OUTPUT sum
SET x = 30 SET y = 24 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 2 SET y = 16 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 3 TO 8 SET sum = sum + i NEXT i OUTPUT sum
SET x = 28 SET y = 48 IF x > y THEN SET result = x - y END IF OUTPUT result
SET x = 18 SET y = 20 SET z = x + y OUTPUT z
SET sum = 0 FOR i = 2 TO 5 SET sum = sum + i NEXT i OUTPUT sum
Assumptions and Conventions
- Programs use TeachSpark pseudocode, not AP or IB exam pseudocode.
- The interpreter runs each program step by step to produce the trace.
- Variables start as undefined (shown as —) until they are assigned a value.
- SET var = value — assign a value to a variable.
- IF condition THEN ... END IF — execute the block only if the condition is true.
- FOR i = start TO end ... NEXT i — repeat with i from start to end inclusive.
- OUTPUT value — print a value.
- Operators: + - * / and MOD (modulo), > < = >= <= <>
Trace Tables - High school CS - On-level scaffold
Short programs in TeachSpark pseudocode with trace tables computed by a built-in interpreter. No AI, no credits.
