New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

ISTQB-CTFL Exam - Topic 1 Question 20 Discussion

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

For the following pseudo-code determine number of tests required for 100% statement coverage

IF Gender = Boy

If Age > 3 AND Age < 5

Shoe Size = 1

ELSE IF Age >=5 AND Age < 7

Shoe Size = 2

ENDIF

ELSE

IF Age > 3 AND Age < 5

Shoe Size = 0

ELSE IF Age >=5 AND Age < 7

Shoe Size = 1

ENDIF

ENDIF

Show Suggested Answer Hide Answer
Suggested Answer: B

To achieve 100% statement coverage, we need to design test cases that ensure every statement in the given pseudo-code is executed at least once. Analyzing the pseudo-code, we notice that there are conditions based on two variables: Gender and Age. To cover all statements, we need to consider the paths that lead to each assignment of the Shoe Size variable.

Gender = Boy, Age <= 3 (Shoe Size assignment is not reached, but the condition is evaluated)

Gender = Boy, Age > 3 AND Age < 5 (Shoe Size = 1)

Gender = Boy, Age >= 5 AND Age < 7 (Shoe Size = 2)

Gender != Boy, Age <= 3 (Again, Shoe Size assignment is not reached, but the condition is evaluated)

Gender != Boy, Age > 3 AND Age < 5 (Shoe Size = 0)

Gender != Boy, Age >= 5 AND Age < 7 (Shoe Size = 1)

However, upon closer inspection, we see that tests 1 and 4 do not contribute to statement coverage as they do not lead to a Shoe Size assignment. Therefore, we only need 4 test cases to achieve 100% statement coverage, making option B the correct answer.


Contribute your Thoughts:

0/2000 characters
Jordan
3 months ago
I thought it was 2 tests at first, but now I'm confused!
upvoted 0 times
...
Hyun
3 months ago
I counted 4 tests, but I might be missing something.
upvoted 0 times
...
Zona
3 months ago
Wait, are we sure about that? Seems like it could be less.
upvoted 0 times
...
Arthur
4 months ago
Definitely agree, 6 seems right!
upvoted 0 times
...
Leandro
4 months ago
I think we need 6 tests for full coverage.
upvoted 0 times
...
Keva
4 months ago
I’m confused about the age conditions. I thought we could get away with just 2 tests, but now I’m not so sure.
upvoted 0 times
...
Reed
4 months ago
I feel like we might need to test each age range separately for both genders, which sounds like it could add up to 6 tests.
upvoted 0 times
...
Jesusa
4 months ago
I'm not entirely sure, but I remember a similar question where we had to account for all possible paths. Could it be 4 tests?
upvoted 0 times
...
Richelle
5 months ago
I think we need to cover both branches for Gender and all the age conditions, so maybe 6 tests?
upvoted 0 times
...
Lindsey
5 months ago
I'm feeling pretty confident about this one. The pseudo-code is clear, and I just need to think through the logic step-by-step to determine the minimum number of tests.
upvoted 0 times
...
Annabelle
5 months ago
This seems like a good opportunity to apply some systematic testing techniques. I'll create a truth table to ensure I cover all possible combinations of the conditions.
upvoted 0 times
...
Leatha
5 months ago
Okay, I think I've got it. The key is to identify the independent conditions that need to be tested. I'll start by testing the outer if-else, then the inner if-else conditions.
upvoted 0 times
...
Matthew
5 months ago
Hmm, I'm a bit confused by the nested if-else statements. I'll need to make sure I understand the control flow before I can determine the number of tests.
upvoted 0 times
...
Allene
5 months ago
This looks like a pretty straightforward question. I'll need to carefully trace through the logic and determine the minimum number of tests required to cover all the statements.
upvoted 0 times
...
Julie
5 months ago
I'm a little confused by this question. The options don't seem to fully explain how database partitioning improves performance. I'll have to review my notes and try to remember the key benefits of partitioning. Hopefully I can figure this out.
upvoted 0 times
...
Amie
5 months ago
Okay, I think I've got this. The key is to apply the bank-specific regulatory multiplier to the average VaR over the past 60 days.
upvoted 0 times
...
Karma
5 months ago
Hmm, I'm a bit unsure about this one. I know the GDPR is an EU regulation, but I'm not sure which specific EU body would handle preliminary interpretations. I'll have to think this through carefully.
upvoted 0 times
...
Yoko
5 months ago
I'm leaning towards $6,000 as the right answer but can't quite remember why. I hope I'm not misremembering anything from the lectures!
upvoted 0 times
...
Alaine
2 years ago
Makes sense, 4 tests cover all paths.
upvoted 0 times
...
Stephaine
2 years ago
We need one test for each condition: boy and girl, and age brackets.
upvoted 0 times
...
Shannon
2 years ago
Why 4?
upvoted 0 times
...
Stephaine
2 years ago
I think the answer is B) 4.
upvoted 0 times
...
Mammie
2 years ago
Yeah, it's a bit complicated.
upvoted 0 times
...
Blossom
2 years ago
This question seems tricky.
upvoted 0 times
...

Save Cancel