ISQI Certified Tester Foundation Level — Question 6
Consider the following pseudo code
1. Begin
2. Read Gender
3. __Print "Dear"
4. If Gender = female
5. Print ("Ms")
6. Else
7. __Print ( "Mr")
8. Endif
9. End
How many test cases are needed to achieve 100 per cent decision coverage?
Answer options
- A. 1
- B. 2
- C. 3
- D. 4
Correct answer: B
Explanation
To achieve 100 percent decision coverage, you need to test both outcomes of the conditional statement. This requires one test case for when Gender is equal to 'female' (which prints 'Ms') and one test case for when Gender is not 'female' (which prints 'Mr'). Therefore, the correct answer is B, as two test cases are necessary.