White-box test techniques · Question 44 of 60
A function "if quantity > 0, then price = total / quantity" is tested with quantity 4 and reaches 100% statement coverage. Later it crashes because the condition in the code wrongly reads "quantity >= 0". Which statements are correct?
2 answers are correct. Hard Created with AI
Show answer
Answer
- A A boundary value test with quantity 0 would have triggered the failure
- B 100% statement coverage does not protect against data-dependent defects such as division by zero
Explanation
The faulty statement was executed, but not with the critical value. Only quantity 0 reveals the division by zero; black-box techniques complement white-box testing here.