Functions · Program Tracing
Read — build a mental model
L2 Comprehension
Relations
~3 min
What does double(4) give back?
What is printed when this program runs?
def double(n):
return n * 2
result = double(4)
print(result + 1)
Why this activity was chosen
- Bloom level: L2 Comprehension: Predict output by simulating execution.
- Block Model level: Relations (step 3 of 4): how parts of the program affect each other: variable updates, function calls, data flow and control flow.
- Misconception targeted: shown after you answer, so it does not give the answer away.
Tracing builds an operational mental model: what is true after each statement. Distractors are drawn from documented novice misconceptions rather than random wrong answers.
AI’s role here: AI may ask the student to fill a trace table. It must not emit the final output on demand.