Correcting Algorithms

Computer Science: OCR A Level, topic 8.1.2

Correcting Algorithms

As well as knowing what an algorithm does, it's important to be able to fix it if it all goes wrong.

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 such as 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, which can lead to issues such as infinite loops, where the code will never end.

Test yourself on Correcting Algorithms

  • Which of these characters gets most commonly confused in programming?

  • What is the most common operator mistake?

Practise this topic for free