CS FundamentalsHardCognizant · Capgemini pattern

A program's control flow graph has two separate connected components (for example, main and one called function drawn separately), with 14 edges and 12 nodes in total. What is its cyclomatic complexity?

  1. A. 8
  2. B. 4
  3. C. 2
  4. D. 6

Correct answer: D. 6

V(G) = E − N + 2P = 14 − 12 + 2(2) = 6. Assuming a single component (P = 1) gives 4.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic