Paper Trace
You'll predict what a program does before you run it, with a pen, paper and a table of variables, and no computer until the end.
About
The computer is too fast to learn from. Running code and watching what happens teaches you very little about why it happened. Tracing by hand, one line at a time with a table of variables, is how you build the model in your head that every good programmer runs on. Do it ten times and you'll start seeing bugs before you type them.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 5
- Takes
- One evening
- Skill level
- Beginner (done it a few times)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Trace a 10-line loop by hand with a variable table, then run it and compare. Make a column for each variable and one row per trip through the loop. Write the final output down before you touch the keyboard. Any program with a loop and two variables will do. Take a photo of your table next to the real output. Photo
-
2
Trace a function that calls another function, tracking what goes in and what comes out. Draw each call as a box with the inputs on top and the return value at the bottom. Do it for three calls with different inputs. Take a photo of the boxes and the matching output. Photo
-
3
Trace a recursive function down to depth four. Factorial or Fibonacci both work. Draw the stack growing and then shrinking again. Most people get the unwinding wrong the first time, and that's exactly the point. Take a photo of the drawing with the final answer. Photo
-
4
Find the bug in a program by tracing it, without running it. Have someone give you a 15-line program with one planted bug, or take an exercise from a textbook. Trace it until your table disagrees with what the program should do. Take a photo of the trace with the bug circled, then a screenshot confirming it. Photo
-
5
Write a program on paper first, then type it in and run it unchanged. Pick something with a loop and a condition, around 15 to 25 lines. Type it in exactly as written. If it runs first time, you're ahead of most people, and if not, count the errors. Take a photo of the paper and a screenshot of the first run, and be honest about the result. Photo