CS FundamentalsHardInfosys · Wipro · ISTQB-style

A loop can execute between 0 and 10 times (n = 10). Following Beizer's guidelines for simple-loop testing, which set of iteration counts should be tested?

  1. A. 0, 5, 10
  2. B. 1, 10
  3. C. 0, 1, 2, a typical value such as 5, 9, 10 and an attempt at 11
  4. D. Every count from 0 to 10

Correct answer: C. 0, 1, 2, a typical value such as 5, 9, 10 and an attempt at 11

Simple-loop testing skips the loop, runs it once and twice, a typical number of times, and n - 1, n and n + 1 (attempting to exceed the limit). The other sets miss the edges where off-by-one loop errors hide, or are exhaustive rather than designed.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic