Six original Cambridge-style trace table questions, each checked by dry-running the code.
Complete a trace table for this algorithm.
A ← 1
B ← 1
FOR I ← 1 TO 4
C ← A + B
A ← B
B ← C
OUTPUT C
NEXT IDry-run the digit-sum algorithm from this lesson with the input 608. Give the values of Digit, Sum and Number after each pass, and the output.
Complete a trace table for this algorithm with the inputs 15, 40, 25, 0.
Max ← 0
Total ← 0
INPUT Value
WHILE Value <> 0 DO
Total ← Total + Value
IF Value > Max
THEN
Max ← Value
ENDIF
INPUT Value
ENDWHILE
OUTPUT Total, " ", MaxState the values of DIV(29, 4) and MOD(29, 4).
Dry-run this algorithm and state each output.
Count ← 10
REPEAT
IF Count > 5
THEN
Count ← Count - 3
ELSE
Count ← Count - 1
ENDIF
OUTPUT Count
UNTIL Count <= 2Explain why a trace table is useful when testing an algorithm.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.