nerdexam
iSQI

CTFL_SYLL_4.0 · Question #96

How is branch coverage determined?

The correct answer is A. By taking the number of branches in the code that have been tested and dividing that by the. Branch coverage is calculated by dividing the number of branches actually executed during testing by the total number of branches in the code, then multiplying by 100 to get a percentage - making A correct. Why the distractors are wrong: B is wrong because branch coverage…

Test Analysis and Design

Question

How is branch coverage determined?

Options

  • ABy taking the number of branches in the code that have been tested and dividing that by the
  • BBy taking the number of branches in the code on one path that has been tested and dividing that
  • CBy taking the number of statements in the code and dividing those by the number of branches
  • DBy counting the number of branches in the code that have been tested

How the community answered

(21 responses)
  • A
    95% (20)
  • B
    5% (1)

Explanation

Branch coverage is calculated by dividing the number of branches actually executed during testing by the total number of branches in the code, then multiplying by 100 to get a percentage - making A correct.

Why the distractors are wrong:

  • B is wrong because branch coverage accounts for all branches across the entire codebase, not just those on a single execution path.
  • C is wrong because it confuses branch coverage with statement coverage; dividing statements by branches is not a recognized metric.
  • D is wrong because simply counting tested branches gives a raw number, not a coverage percentage - you need to divide by the total branch count to get a meaningful coverage metric.

Memory tip: Think of branch coverage like a report card - your grade (coverage %) = what you earned (tested branches) divided by what you could have earned (all branches). Without the denominator, you just have a score with no context.

Topics

#branch coverage#structural testing#coverage metrics#white-box testing

Community Discussion

No community discussion yet for this question.

Full CTFL_SYLL_4.0 Practice