nerdexam
BCS-ISEB

BH0-010 · Question #215

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")…

The correct answer is C. 3. The three decisions are in sequence and the conditions are all mutually exclusive (if any one is true the others must be false). Hence a test case that makes the first decision true will make the second and third decisions false and so on. So test case 1 (say Time = 6) would…

Test design techniques

Question

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 How many test cases are needed to achieve 100 per cent decision coverage?

Options

  • A1
  • B2
  • C3
  • D4

How the community answered

(37 responses)
  • A
    3% (1)
  • B
    16% (6)
  • C
    73% (27)
  • D
    8% (3)

Explanation

The three decisions are in sequence and the conditions are all mutually exclusive (if any one is true the others must be false). Hence a test case that makes the first decision true will make the second and third decisions false and so on. So test case 1 (say Time = 6) would exercise the path True, False, False, test case 2 (say Time = 15) would exercise the path False, True, False. Test case 3 would have to be Time = 12. This combination achieves 100 per cent decision coverage because each decision has been exercised through its true and its false outcomes.

Topics

#decision coverage#white-box testing#control flow#test case count

Community Discussion

No community discussion yet for this question.

Full BH0-010 Practice