Seneca

Correcting Algorithms

Computer Science: KS3, topic 1.2.6

Correcting Algorithms

Knowing what an algorithm does is important. Being able to fix an algorithm if it all goes wrong is also important.

Incorrect identifiers

Incorrect identifiers

  • A common mistake in programs is incorrect identifiers.
  • Be very careful with uppercase and lowercase letters.
  • Be careful with similar looking characters:
  • 0 and O.
  • 1 and l (lower case L).
Incorrect operators

Incorrect operators

  • Look out for the difference between similar operators.
  • One example is testing if a number is less than another, rather than less than or equal to the other.
Missing processes

Missing processes

  • Sometimes a line of code has been forgotten.
  • A forgotten line of code can lead to issues such as infinite loops.
  • In an infinite loop, the code will never end.

Test yourself on Correcting Algorithms

  • Which pair of characters can easily be confused when typing an identifier?

  • Which operator mistake can cause errors in an algorithm?

Practise this topic for free