nerdexam
iSQI

CTFL_SYLL_4.0 · Question #86

When tests are being created to achieve statement coverage, what are they exercising?

The correct answer is C. Only the executable statements in the code. Statement coverage targets every executable statement in the code, ensuring each one is run at least once during testing. This is why C is correct - the goal is to verify that no executable line is left untested, catching dead code or unreachable paths. Why the distractors are…

Test Analysis and Design

Question

When tests are being created to achieve statement coverage, what are they exercising?

Options

  • AOnly the decisions in the code
  • BOnly the loops in the code
  • COnly the executable statements in the code
  • DAll lines of code including executable statements and comments

How the community answered

(45 responses)
  • A
    4% (2)
  • B
    7% (3)
  • C
    87% (39)
  • D
    2% (1)

Explanation

Statement coverage targets every executable statement in the code, ensuring each one is run at least once during testing. This is why C is correct - the goal is to verify that no executable line is left untested, catching dead code or unreachable paths.

Why the distractors are wrong:

  • A is wrong because targeting only decisions describes decision/branch coverage, a stricter level above statement coverage.
  • B is wrong because loop-only testing would be a subset of statements - statement coverage is broader and isn't limited to loops.
  • D is wrong because comments are not executable; they're ignored by the compiler/interpreter and cannot be "exercised" by tests.

Memory tip: Think of "statement = something the machine executes." If the machine doesn't run it, it's not a statement in this context. Statement coverage = "did every runnable line get hit at least once?"

Topics

#statement coverage#white-box testing#code coverage#executable statements

Community Discussion

No community discussion yet for this question.

Full CTFL_SYLL_4.0 Practice