CS FundamentalsModerateCognizant · Capgemini pattern

A control flow graph has 9 edges and 7 nodes and is a single connected component. What is its cyclomatic complexity?

  1. A. 2
  2. B. 3
  3. C. 4
  4. D. 16

Correct answer: C. 4

V(G) = E − N + 2P = 9 − 7 + 2(1) = 4. Forgetting the +2P term gives 2.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic