CTAL-TTA_001 · Question #28
How many test cases would be needed to achieve 100% statement coverage? 1 credit [K2]
The correct answer is A. 1. Option A is correct because statement coverage only requires every executable statement to be executed at least once - and a single test case that runs through the code from top to bottom is sufficient if the code has no branching logic (no if/else, no loops with multiple…
Question
How many test cases would be needed to achieve 100% statement coverage? 1 credit [K2]
Options
- A1
- B2
- C3
- D4
How the community answered
(16 responses)- A94% (15)
- D6% (1)
Explanation
Option A is correct because statement coverage only requires every executable statement to be executed at least once - and a single test case that runs through the code from top to bottom is sufficient if the code has no branching logic (no if/else, no loops with multiple outcomes). With purely sequential code, one execution path hits every statement.
Why the distractors are wrong:
- B (2), C (3), and D (4) would apply to stronger coverage criteria: 2 test cases are typically needed for branch coverage (true/false paths), more for condition coverage or path coverage. Candidates often confuse statement coverage with these stronger criteria.
Memory tip: Think of coverage criteria as a ladder - Statement < Branch < Condition < Path. Statement coverage sits at the bottom, requiring the fewest test cases. If the question says "statement coverage" and the code is linear, the answer is almost always the smallest number offered.
Topics
Community Discussion
No community discussion yet for this question.