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 CTFL-Foundation Exam - Topic 1 Question 39 Discussion

Posted by Shannan on Jul 07, 2025 at 09:36 PM

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?

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.


Get Premium CTFL-Foundation Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
30 comments · newest first
TY
Tyisha 10 months ago
I thought it was just 2 cases, am I missing something?
AR
Arthur 10 months ago
I think it's actually 4 cases.
KI
Kiley 10 months ago
Wait, how does 12 noon fit in there?
LO
Louann 10 months ago
Definitely 3, one for each condition.
EL
Eliseo 11 months ago
You need 3 test cases for full coverage.
MA
Marget 11 months ago
I feel like two cases might be enough if we just focus on the am and pm scenarios, but I could be missing something.
AD
Adelaide 11 months ago
I’m a bit confused about the “Time = 12” condition. Does that mean we need a separate case for noon?
LI
Ling 11 months ago
I remember practicing a similar question, and I think we might need four cases to cover all the conditions properly.
LE
Lenna 11 months ago
I think we need at least three test cases to cover all the decision points, but I'm not entirely sure.
DI
Diego 12 months ago
I'm not totally sure how to approach this. The pseudo-code seems simple enough, but I want to make sure I'm not missing anything. Maybe I'll start by writing out some sample input values and tracing through the logic.
BA
Basilia 12 months ago
Okay, let's see here. I need to test the conditions for Time < 12, Time > 12, and Time = 12. That should cover all the decision points and give me 100% decision coverage. Easy peasy!
KA
Katie 12 months ago
Hmm, I'm a bit confused by the pseudo-code. I'll need to carefully go through each step to make sure I understand the logic before I can determine the test cases.
FE
Fernanda 1 year ago
This looks like a pretty straightforward problem. I think I can handle it - just need to identify the different conditions and test cases.
AR
Aracelis 1 year 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.
GR
Gregg 1 year ago
↳ replying to Aracelis
Yeah, it's pretty straightforward. Just need to test all three conditions.
CL
Claribel 1 year ago
↳ replying to Aracelis
I agree, the answer is C) 3. It's a simple if-else statement.
RE
Rene 1 year 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.
WI
Willie 1 year ago
↳ replying to Rene
User 2: Yeah, it's a simple if-else statement.
VI
Victor 1 year ago
↳ replying to Rene
User 1: I think the answer is C) 3.
AR
Ariel 1 year 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!
MA
Margurite 1 year 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.
LE
Leeann 1 year 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.
LO
Loreta 1 year ago
↳ replying to Leeann
I think the answer is C) 3 as well. Each decision point needs to be tested.
JU
Justine 1 year ago
↳ replying to Leeann
I agree, we need to test all three conditions to achieve 100% decision coverage.
LA
Laurel 1 year ago
↳ replying to Leeann
So the answer is C) 3 test cases needed for 100% decision coverage.
PE
Pearly 1 year ago
↳ replying to Leeann
Yes, that's correct. Each decision point needs to be tested in order to cover all possible outcomes.
EM
Emerson 1 year ago
↳ replying to Leeann
I agree, we need to test all three conditions to achieve 100% decision coverage.
JO
Joaquin 1 year ago
I believe the answer is C) 3 because we need to test each condition separately.
LA
Lauran 1 year ago
I agree with Alease, we need to cover all the branches in the code.
AL
Alease 1 year ago
I think we need 3 test cases for 100% decision coverage.
0/2000 characters

Save Cancel