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 Exam - Topic 1 Question 20 Discussion

Posted by Edna on May 10, 2024 at 10:45 PM

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

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.


Get Premium ISTQB-CTFL Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
24 comments · newest first
JO
Jordan 10 months ago
I thought it was 2 tests at first, but now I'm confused!
HY
Hyun 11 months ago
I counted 4 tests, but I might be missing something.
ZO
Zona 11 months ago
Wait, are we sure about that? Seems like it could be less.
AR
Arthur 11 months ago
Definitely agree, 6 seems right!
LE
Leandro 11 months ago
I think we need 6 tests for full coverage.
KE
Keva 12 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.
RE
Reed 12 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.
JE
Jesusa 12 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?
RI
Richelle 1 year ago
I think we need to cover both branches for Gender and all the age conditions, so maybe 6 tests?
LI
Lindsey 1 year 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.
AN
Annabelle 1 year 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.
LE
Leatha 1 year 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.
MA
Matthew 1 year 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.
AL
Allene 1 year 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.
JU
Julie 1 year 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.
AM
Amie 1 year 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.
KA
Karma 1 year 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.
YO
Yoko 1 year 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!
AL
Alaine 2 years ago
Makes sense, 4 tests cover all paths.
ST
Stephaine 2 years ago
We need one test for each condition: boy and girl, and age brackets.
SH
Shannon 2 years ago
Why 4?
ST
Stephaine 2 years ago
I think the answer is B) 4.
MA
Mammie 2 years ago
Yeah, it's a bit complicated.
BL
Blossom 2 years ago
This question seems tricky.
0/2000 characters

Save Cancel