Testing an algorithm with different starting values
A chosen starting value you try in an algorithm, with the result you expect. Use one for every path and for a loop that runs zero times, then compare expected and actual results.
Understanding Testing an algorithm with different starting values in ACARA Digital Technologies Years 5–6
What it does: The tester writes down the expected result, runs the algorithm to get the actual result, and a mismatch shows a bug. One value that makes the condition true and one that makes it false test both paths of the decision. Age 8 uses the ELSE path and age 15 uses the THEN path. 15 and 20 both take the THEN path, so the ELSE path is never tested. When the expected and actual results are different, the test has found a problem. Check the steps to find the mistake. Each path needs its own test value, for example 30, 65 and 90. One value only tests one path.
Common mistakes: The rule says 50 or more is a Pass, so the test case with score 50 should expect Pass, not Fail. Repeating n + 1 times would say Hello once even when n is 0. The loop should repeat n TIMES so it runs zero times for 0.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 120–132) and word search (Modules 106–132).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
test caseFill in the Blanks
Spot the Error
Student with a class code? Join your class →