Identifying errors

<< Previous: Designing algorithmsNext: Searching algorithms >>

Types of errors

There are two types of error you need to be familiar with:

Identifying errors

You need to be able to identify the syntax and logic errors in programs. The pseudocode algorithm below totals all the numbers in the 0-indexed array scores.

Logic error: Line 2. Should start at 0 not 1 or else the first number in the array is not included.
Syntax error: Line 3. Square brackets are required to access elements of an array.

Trace table

A trace table is a method for helping to identify problems in an algorithm. It is a table that tracks the values of variables in a program as the program is executed.

Knowledge check


Questions:
Correct:

Question text


<< Previous: Designing algorithmsNext: Searching algorithms >>

© All materials created by and copyright S.Goff