Sequence 1 · Topic 3.10 Lists
Trace investigation
About 30 minutes. Pick a version and a test, predict the returned value, then step through the trace one line at a time. Your goal is to find a test that exposes each of the three buggy versions. This is a step-by-step simulation of these four procedures, not a code runner.
Version A with [4, 0, 12, 7], threshold 5
PROCEDURE CountAtLeast(readings, threshold){ count ← 0 FOR EACH r IN readings { IF (r ≥ threshold) { count ← count + 1 } } RETURN count}Bug hunt: find a test that exposes each buggy version
- Version B:not exposed yet
- Version C:not exposed yet
- Version D:not exposed yet
A test counts once you have predicted and run it. Progress lives on this page only and resets when you leave.