Multiple choice

Consider the following statements about the cyclomatic complexity of the control flow graph of a program module. Which of these are TRUE?

I. The cyclomatic complexity of a module is equal to the maximum number of linearly independent circuits in the graph. II. The cyclomatic complexity of a module is the number of decisions in the module plus one, where a decision is effectively any conditional statement in the module. III. The cyclomatic complexity can also be used as a number of linearly independent paths that should be tested during path coverage testing.

  1. I and II

  2. II and III

  3. I and III

  4. I, II and III

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Statement I is FALSE - cyclomatic complexity equals E - N + 2P (or decisions + 1), not the number of independent circuits. Statement II is TRUE - V(G) = number of predicates + 1 in control flow. Statement III is TRUE - cyclomatic complexity gives the number of basis paths to test. Only II and III are correct.