ISQI Certified Tester Foundation Level — Question 11
Consider the following pseudo code:
1 Begin
2 Read Time
3 If Time < 12 Then
4 Print(Time, "am")
5 Endif
6 If Time > 12 Then
7 Print(Time 12, "pm")
8 Endif
9 If Time = 12 Then
10 Print (Time, "noon")
11 Endif
12 End
If the test cases Time = 11 and Time = 15 were input, what level of decision coverage would be achieved?
Answer options
- A. 100% or 6/6
- B. 50% or 3/6
- C. 67% or 4/6
- D. 83% or 5/6
Correct answer: D
Explanation
The correct answer is D because both inputs Time = 11 and Time = 15 cover five of the six decision points in the code. Time = 11 evaluates the first condition (Time < 12) and Time = 15 evaluates the second condition (Time > 12), while the third condition (Time = 12) is not tested. Thus, 5 out of 6 decisions are covered, resulting in 83% coverage. The other options do not accurately reflect the coverage achieved.