Halloween Special 2026! Get Up to 25% OFF Practice Questions! Limited Time - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

ISTQB CTFL-Foundation Exam - Topic 1 Question 12 Discussion

Posted by Golda on Apr 28, 2024 at 06:41 AM

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?

Suggested Answer: D

Get Premium CTFL-Foundation Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
41 comments · newest first
BE
Ben 11 months ago
I thought we might need more for edge cases, but 2 works!
CU
Curt 11 months ago
2 is definitely right, just male and female.
FR
Franklyn 11 months ago
Wait, why not 3? Seems like there's more to cover.
LU
Luther 12 months ago
Totally agree, one for each gender!
ED
Edna 12 months ago
You need 2 test cases for full coverage.
EL
Elliot 12 months ago
I’m leaning towards two test cases as well, since we just need to test the decision point for gender.
VA
Vallie 1 year ago
I feel like we might need four test cases to cover all possible scenarios, but that seems excessive for this code.
NO
Nohemi 1 year ago
I remember practicing a similar question, and I think it was three test cases, but I can't recall the details.
FA
Farrah 1 year ago
I think we need at least two test cases, one for 'female' and one for 'male', but I'm not entirely sure if that's enough for full coverage.
JA
Jaime 1 year ago
I've got it! We need three test cases - one for 'female', one for 'male', and one for some other value of 'Gender' to make sure the code handles that case correctly. That should give us 100% decision coverage.
KA
Kayleigh 1 year ago
Wait, I'm a bit confused. Do we need to consider any other possible values for 'Gender' besides 'female' and 'male'? I want to make sure I'm not missing anything.
FA
Fannie 1 year ago
Okay, let me think this through. We need to cover both the 'female' and 'not female' (i.e., 'male') cases, right? So that's at least two test cases.
GL
Glenn 1 year ago
Hmm, this looks like a pretty straightforward decision coverage problem. I think I can handle this one.
KA
Katheryn 1 year ago
I'm not convinced this is the best approach. Automating tasks is one thing, but sharing knowledge articles might require a more robust solution. I'll need to explore other options to ensure we meet all the requirements.
EL
Elizabeth 1 year ago
Hmm, I'm a bit unsure about this one. The options seem similar, but I think the key is understanding what "explicit opt-in" means in the context of mobile marketing. I'll need to think this through carefully.
AL
Alesia 1 year ago
Okay, I've got this. Life insurance is commonly used for estate planning, business continuity, and replacing income - the options seem to cover those main uses. I just need to identify the one that doesn't fit.
CO
Corinne 1 year ago
Wait, what if the gender is 'other'? Shouldn't we test that case too? Or maybe the code should just use 'Mx' instead of 'Mr' or 'Ms'.
TI
Tiffiny 1 year ago
↳ replying to Corinne
Yes, testing for 'other' gender and adding 'Mx' as an option would improve the code.
RO
Roxane 1 year ago
↳ replying to Corinne
I think adding 'Mx' as an option would be a good idea.
LA
Lavelle 1 year ago
↳ replying to Corinne
I agree, we need to make sure the code covers all possibilities.
AN
Annelle 1 year ago
↳ replying to Corinne
We should definitely test for the 'other' gender case.
LA
Latia 1 year ago
Well, at least this question doesn't involve any complex algorithms or data structures. I can handle a simple if-else statement!
MU
Murray 1 year ago
↳ replying to Latia
Yep, just one test case for 'female' and one for 'male' should do the trick for 100% decision coverage.
CA
Carmen 1 year ago
↳ replying to Latia
I agree, only 2 test cases are needed to cover both 'female' and 'male' genders.
LE
Leigha 1 year ago
↳ replying to Latia
True, this question is pretty straightforward. Just need to cover both branches of the if-else statement.
RO
Rodolfo 1 year ago
Hmm, I'm not sure. Maybe I should draw a decision tree to visualize all the possible paths. That might help me figure this out.
MI
Michael 1 year ago
↳ replying to Rodolfo
I agree, visualizing the paths might make it easier to determine the number of test cases needed.
SE
Serina 1 year ago
↳ replying to Rodolfo
I think creating a decision tree is a good idea. It will help you see all the paths clearly.
LA
Lavonna 1 year ago
↳ replying to Rodolfo
You could also try creating truth tables to see all the possible combinations.
LO
Louis 1 year ago
I think the question is pretty straightforward. You just need to check the two possible outcomes of the gender check, right?
LA
Lavina 1 year ago
↳ replying to Louis
That makes sense. It's important to cover all possible paths in the code.
TA
Tasia 1 year ago
↳ replying to Louis
So, we only need 2 test cases to achieve 100 per cent decision coverage.
TH
Theodora 1 year ago
↳ replying to Louis
Yes, you are correct. We just need to test both outcomes of the gender check.
DO
Dominga 2 years ago
I believe the answer is C) 3, as we need to test for 'female', 'male', and the default case.
LE
Leslie 2 years ago
I agree with Dannie, because we need to test both the 'female' and 'male' branches.
VA
Valene 2 years ago
The correct answer is B) 2 test cases. One for 'female' and one for 'male' to achieve 100% decision coverage.
EL
Elouise 1 year ago
↳ replying to Valene
Thanks for the clarification!
SE
Sean 1 year ago
↳ replying to Valene
So the correct answer is B) 2 test cases.
CH
Charlene 1 year ago
↳ replying to Valene
That's right, one for 'female' and one for 'male'.
NO
Nohemi 1 year ago
↳ replying to Valene
You only need 2 test cases to achieve 100% decision coverage.
DA
Dannie 2 years ago
I think we need 3 test cases to achieve 100% decision coverage.
0/2000 characters

Save Cancel