F07 · Topic 3.1 · 3.3
Variable trace studio
1. Predict first
Start a 4,b 9. Predict a←b; b←a. Then predict temp←a; a←b; b←temp using a fresh copy of the starting values.
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Input 14Waiting
- Input 29Waiting
- Input 35Waiting
Ready to experiment
Why: Predict the first change, then advance one step.
Try this: Change one input, predict the difference, then reset and compare.
2. Build your procedure
Write a state table for both sequences, including temp. Then calculate (a+2*b) MOD divisor from the original inputs and state the order of operations.
Use AP CSP pseudocode, a language you know, or precise plain language. Your code is not executed here. Use the classroom assignment to save your response.
3. Check boundaries
| Input | Expected | Why this case |
|---|---|---|
| a4,b9,divisor5 | Overwrite[9,9]; swap[9,4]; expression 2 | Distinct initial values expose lost state. |
| a7,b7,divisor3 | Both sequences[7,7]; expression 0 | Equal values conceal the swap defect. |
| a0,b5,divisor2 | Swap[5,0]; expression 0 | Zero remains a valid value. |
4. Explain and reflect
Why is one test with equal input values insufficient to distinguish the two swap algorithms?
Model limits: Traces fixed assignment sequences and a specified arithmetic expression. It never executes submitted code.