Foundation to VCE • Explore the maths library • Try a free sample
Year 8 · Algebra

Testing and debugging algorithms

Trace algorithms and use test cases to find and correct errors.

3 printable resources11 pages12 questionsWorked answers
A$2.90Planned launch price · including GST
One household or one teacher’s own classes
Preview available. Checkout opens soon.The full topic collection is prepared. Explore a sample before choosing.

What you’ll work on

  • Trace algorithms and use test cases to find and correct errors.
  • Explain a method and check the reasonableness of a result.

Start with the idea

An algorithm needs clear inputs, ordered operations and outputs. A trace table records intermediate values so errors can be located.

Test normal cases, boundary cases and unusual valid inputs. A test that happens to work does not prove an algorithm is correct for every input.

A worked example

An area algorithm outputs length+width for a rectangle. Test 8 and 3, then fix it.

  1. The algorithm outputs 11.
  2. Rectangle area should 8×3=24; replace addition with multiplication.

Answer: Output length×width

Try one question

Trace: start n=5; n=n+3; n=2n. Find output.

Show answer and explanation

16

5→8→16.

Inside the collection

ResourceLengthPracticeAnswers
Learn and practise4 pages4 questionsIncluded
Apply and extend4 pages4 questionsIncluded
Topic checkpoint3 pages4 questionsIncluded

Read on a device and work in an exercise book, or print the A4 PDFs. These files are not auto-marked digital quizzes.

Keep building your skills.

Explore more Year 8 topics