Computer Science I / Loops and Repeated Computation
Practice question · True or false

An off-by-one error in a loop boundary usually causes a crash, which is what makes it easy to find.

Hints
  1. What happens if the loop simply skips the last item?
  2. A wrong answer is quieter than a crash.
Show the answer

False

Why

False. Off-by-one errors usually produce a wrong result — one item skipped, one processed twice — with no crash at all, which is exactly what makes them hard to find. They surface as a total that is slightly off, and only an out-of-range index turns one into an exception.

Read the lesson: Loops and Repeated Computation →

Practise Loops and Repeated Computation

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Loops and Repeated Computation