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?
- A. 0, 5, 10
- B. 1, 10
- C. 0, 1, 2, a typical value such as 5, 9, 10 and an attempt at 11
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A function is a straight sequence of three independent if-else statements, with no loops. What are (total entry-to-exit paths, cyclomatic…
- How many definition-use (def-use) pairs does variable x have in this fragment (a p-use in a condition counts as a use)? python x =…
- For the function below, the tests (age = 30, member = True) and (age = 10, member = False) already give 100% statement and branch…
- McCabe's V(G) = E - N + 2 for one function comes from the cyclomatic number of a strongly connected graph, E - N + P. Where does the '+2'…
- A loan is approved if (salary ≥ ₹50,000 AND credit history is good) OR a guarantor is provided. Using a limited-entry decision table with…
- An ATM state machine: inserting a card leads to '1st try'. A correct PIN in any try state leads to 'Access'; a wrong PIN moves 1st → 2nd →…