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 12 Discussion

Consider the following pseudo code1. Begin2. Read Gender3. __Print ''Dear''4. If Gender = 'female'5. Print (''Ms'')6. Else7. __Print ( ''Mr'')8. Endif9. EndHow many test cases are needed to achieve 100 per cent decision coverage?
D) 4
A) 1
B) 2
C) 3

ISTQB CTFL-Foundation Exam - Topic 1 Question 12 Discussion

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

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?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Ben
8 months ago
I thought we might need more for edge cases, but 2 works!
upvoted 0 times
...
Curt
8 months ago
2 is definitely right, just male and female.
upvoted 0 times
...
Franklyn
8 months ago
Wait, why not 3? Seems like there's more to cover.
upvoted 0 times
...
Luther
9 months ago
Totally agree, one for each gender!
upvoted 0 times
...
Edna
9 months ago
You need 2 test cases for full coverage.
upvoted 0 times
...
Elliot
9 months ago
I’m leaning towards two test cases as well, since we just need to test the decision point for gender.
upvoted 0 times
...
Vallie
9 months ago
I feel like we might need four test cases to cover all possible scenarios, but that seems excessive for this code.
upvoted 0 times
...
Nohemi
9 months ago
I remember practicing a similar question, and I think it was three test cases, but I can't recall the details.
upvoted 0 times
...
Farrah
9 months 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.
upvoted 0 times
...
Jaime
9 months 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.
upvoted 0 times
...
Kayleigh
10 months 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.
upvoted 0 times
...
Fannie
10 months 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.
upvoted 0 times
...
Glenn
10 months ago
Hmm, this looks like a pretty straightforward decision coverage problem. I think I can handle this one.
upvoted 0 times
...
Katheryn
10 months 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.
upvoted 0 times
...
Elizabeth
10 months 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.
upvoted 0 times
...
Alesia
10 months 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.
upvoted 0 times
...
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'.
upvoted 0 times
Tiffiny
1 year ago
Yes, testing for 'other' gender and adding 'Mx' as an option would improve the code.
upvoted 0 times
...
Roxane
1 year ago
I think adding 'Mx' as an option would be a good idea.
upvoted 0 times
...
Lavelle
1 year ago
I agree, we need to make sure the code covers all possibilities.
upvoted 0 times
...
Annelle
1 year ago
We should definitely test for the 'other' gender case.
upvoted 0 times
...
...
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!
upvoted 0 times
Murray
1 year ago
Yep, just one test case for 'female' and one for 'male' should do the trick for 100% decision coverage.
upvoted 0 times
...
Carmen
1 year ago
I agree, only 2 test cases are needed to cover both 'female' and 'male' genders.
upvoted 0 times
...
Leigha
1 year ago
True, this question is pretty straightforward. Just need to cover both branches of the if-else statement.
upvoted 0 times
...
...
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.
upvoted 0 times
Michael
1 year ago
I agree, visualizing the paths might make it easier to determine the number of test cases needed.
upvoted 0 times
...
Serina
1 year ago
I think creating a decision tree is a good idea. It will help you see all the paths clearly.
upvoted 0 times
...
Lavonna
1 year ago
You could also try creating truth tables to see all the possible combinations.
upvoted 0 times
...
...
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?
upvoted 0 times
Lavina
1 year ago
That makes sense. It's important to cover all possible paths in the code.
upvoted 0 times
...
Tasia
1 year ago
So, we only need 2 test cases to achieve 100 per cent decision coverage.
upvoted 0 times
...
Theodora
1 year ago
Yes, you are correct. We just need to test both outcomes of the gender check.
upvoted 0 times
...
...
Dominga
1 year ago
I believe the answer is C) 3, as we need to test for 'female', 'male', and the default case.
upvoted 0 times
...
Leslie
1 year ago
I agree with Dannie, because we need to test both the 'female' and 'male' branches.
upvoted 0 times
...
Valene
1 year ago
The correct answer is B) 2 test cases. One for 'female' and one for 'male' to achieve 100% decision coverage.
upvoted 0 times
Elouise
1 year ago
Thanks for the clarification!
upvoted 0 times
...
Sean
1 year ago
So the correct answer is B) 2 test cases.
upvoted 0 times
...
Charlene
1 year ago
That's right, one for 'female' and one for 'male'.
upvoted 0 times
...
Nohemi
1 year ago
You only need 2 test cases to achieve 100% decision coverage.
upvoted 0 times
...
...
Dannie
1 year ago
I think we need 3 test cases to achieve 100% decision coverage.
upvoted 0 times
...

Save Cancel