A software component has the code shown below:
Program BiggestA, Biggest: Integer Begin Read A Biggest = 10 While A > 0 Do If A > Biggest Then Biggest = A Endif Read A Enddo End
The component has exit criteria for component testing that include 100% statement coverage. Which of the following test cases will satisfy this criterion?
Suggested Answer: D
Get Premium CTFL Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
34 comments · newest first
KY
Kyoko
11 months ago
Definitely, option B won't hit all statements.
RO
Rosita
11 months ago
Wait, does 100% statement coverage really mean all paths?
ED
Edna
12 months ago
Nah, option D covers all the branches too.
TU
Tuyet
12 months ago
I think option C is the best choice here.
DI
Dick
1 year ago
The initial value of Biggest is set to 10.
HY
Hyman
1 year ago
I’m confused about which test cases actually execute the "If" statement. I need to double-check how many times each option reads A.
JA
Jaime
1 year ago
I feel like we practiced a similar question, and I think option D could also work because it tests the condition where A is greater than Biggest.
TA
Tamekia
1 year ago
I'm not entirely sure, but I think option C might cover all the statements since it includes a value greater than 10.
SH
Shelia
1 year ago
I remember we discussed statement coverage and how we need to execute every line of code at least once.
GL
Gladis
1 year ago
Easy peasy! The test cases that will satisfy the coverage requirement are the ones that hit the different branches of the conditional statement and the loop. I'd go with option C.
TI
Tiera
1 year ago
Okay, I think I've got it. The key is to cover all the different paths through the code, including the case where the input value is greater than the current biggest value.
TA
Tamekia
1 year ago
Hmm, I'm a bit confused by the code. I'll need to spend some time understanding how the program works before I can decide on the test cases.
AL
Alisha
1 year ago
This looks like a pretty straightforward question. I'll need to carefully trace the logic of the code to determine which test cases will satisfy the 100% statement coverage requirement.
RO
Roselle
1 year ago
Hmm, I'm a bit unsure about the details of vSphere Namespaces. Let me think this through carefully.
NI
Nicolette
2 years ago
I think the answer is A) 0 because it covers all the statements in the code.
AL
Aleshia
2 years ago
Haha, this code looks like it was written by a programmer who just discovered the 'While' loop. But I'd say option C is the way to go.
SH
Shawna
2 years ago
Option C includes all the necessary values for testing this code.
WA
Walton
2 years ago
I think option C is the best test case scenario for this code.
CR
Cruz
2 years ago
Yeah, option C seems to be the most comprehensive choice.
BE
Bev
2 years ago
I agree, option C covers all the possibilities.
SY
Sylvie
2 years ago
I'm not sure, but I think both C) and D) could satisfy the criteria.
TI
Tiffiny
2 years ago
I'm going with C, 10, 5, 0. It's the most comprehensive test case that checks the program's behavior for different input values.
RA
Raelene
2 years ago
I agree, but C) 10, 5, 0 provides more thorough testing with additional input values.
GE
Geoffrey
2 years ago
I think B) 10, 0 would also cover all the statements in the code.
MA
Matthew
2 years ago
I disagree, I believe the answer is D) 10, 11, 0.
JU
Junita
2 years ago
I think the answer is C) 10, 5, 0.
ST
Stefany
2 years ago
Hmm, I'm torn between B and C. Both seem to cover all the statements, but C might be a bit more thorough in testing the different scenarios.
EV
Eve
2 years ago
I agree, C seems like a more thorough test case.
IL
Ilene
2 years ago
I think C covers more scenarios, so it might be the better choice.
TR
Tresa
2 years ago
D, 10, 11, 0 looks good to me. It covers all the different conditions, including the edge case where the input is greater than the current biggest value.
PA
Pauline
2 years ago
I think option B, 10, 0, is the answer. It hits all the statements in the code and satisfies the 100% statement coverage.
ID
Idella
2 years ago
I believe option D is incorrect, as it includes a value that is not greater than 10.
RE
Remedios
2 years ago
I think option C might also work, as it includes more values to test.
WE
Werner
2 years ago
I agree, option B covers all the statements in the code.