ISQI Certified Tester Foundation Level — Question 17

Consider the following pseudo code:
1. Begin
2. Input X, Y
3. If X > Y
4. __Print (X, is greater than, Y)
5. Else
6. __Print (Y, is greater than or equal to, X)
7. EndIf
8. End
What is the minimum number of test cases required to guarantee both 100% statement coverage and 100% decision coverage?

Answer options

Correct answer: B

Explanation

The correct answer is B because to achieve 100% statement coverage, you need at least two test cases: one where X is greater than Y and one where Y is greater than or equal to X. For 100% decision coverage, the same two test cases suffice, as they cover both branches of the if-else statement.