Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

ISTQB Exam CTFL-Foundation Topic 1 Question 39 Discussion

Actual exam question for ISTQB's CTFL-Foundation exam
Question #: 39
Topic #: 1
[All CTFL-Foundation Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: C

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.


Contribute your Thoughts:

Fernanda
2 days ago
This looks like a pretty straightforward problem. I think I can handle it - just need to identify the different conditions and test cases.
upvoted 0 times
...
Aracelis
2 months ago
This question is a piece of cake! The answer is clearly C) 3. I bet the developer who wrote this code was napping on the job. Still, it's a good way to test our understanding of decision coverage.
upvoted 0 times
Claribel
5 days ago
I agree, the answer is C) 3. It's a simple if-else statement.
upvoted 0 times
...
Gregg
9 days ago
Yeah, it's pretty straightforward. Just need to test all three conditions.
upvoted 0 times
...
...
Rene
2 months ago
I'm a bit confused. Isn't this just a simple if-else statement? I think the answer is C) 3, but I'm not a 100% sure. Maybe I should ask the professor for some extra credit opportunities to boost my grade.
upvoted 0 times
Willie
6 days ago
User 2: Yeah, it's a simple if-else statement.
upvoted 0 times
...
Victor
6 days ago
User 1: I think the answer is C) 3.
upvoted 0 times
...
...
Ariel
2 months ago
Ha! The code is so simple, even a caveman could figure it out. I'm going with B) 2 test cases. One for Time < 12 and one for Time > 12. Easy peasy!
upvoted 0 times
...
Margurite
2 months ago
Hmm, I'm not so sure. Wouldn't you need 4 test cases to cover all the possibilities? One for Time < 12, one for Time > 12, one for Time = 12, and one for the default case where none of the conditions are true.
upvoted 0 times
...
Leeann
2 months ago
I think the answer is C) 3. The code has three decision points: Time < 12, Time > 12, and Time = 12. To achieve 100% decision coverage, we need to test each of these conditions.
upvoted 0 times
Justine
5 days ago
I agree, we need to test all three conditions to achieve 100% decision coverage.
upvoted 0 times
...
Loreta
7 days ago
I think the answer is C) 3 as well. Each decision point needs to be tested.
upvoted 0 times
...
Laurel
2 months ago
So the answer is C) 3 test cases needed for 100% decision coverage.
upvoted 0 times
...
Pearly
2 months ago
Yes, that's correct. Each decision point needs to be tested in order to cover all possible outcomes.
upvoted 0 times
...
Emerson
2 months ago
I agree, we need to test all three conditions to achieve 100% decision coverage.
upvoted 0 times
...
...
Joaquin
3 months ago
I believe the answer is C) 3 because we need to test each condition separately.
upvoted 0 times
...
Lauran
3 months ago
I agree with Alease, we need to cover all the branches in the code.
upvoted 0 times
...
Alease
3 months ago
I think we need 3 test cases for 100% decision coverage.
upvoted 0 times
...

Save Cancel