What this block does
Code Tracing presents a code file with fields for predicted output and named variable values. It assesses reading and reasoning about code rather than writing a new program.
Configure the activity
- Insert Code Tracing and explain what students should determine.
- Add the program to the code file.
- Set the expected output.
- Add each variable you want students to track, with its expected value.
- Set points and choose whether answer matching ignores case or whitespace.
Example: follow the loop
In the sample below, total begins at zero. The loop adds 1, 2, and 3. The final value of total is 6, and the printed output is 6. The real block below lets you enter your predictions locally. It does not run the program or submit your work for grading.
Grading behavior
Expected output and variable values are configured by the instructor. Case and whitespace options control matching. Make the prompt explicit about the moment at which students should report a variable’s value: after one iteration, or after the whole program finishes.
Troubleshooting
If students disagree about a variable value, check whether the prompt identifies the point in execution. If correct output is rejected, inspect formatting and the whitespace setting. Use a Code Editor activity when students need to modify or execute code instead of predicting it.