CS FundamentalsHardGATE CS · Infosys

A planar control-flow graph of a single function has 11 nodes and 14 edges. By the region method, McCabe's V(G) equals the number of regions the graph divides the plane into. Which statement is correct?

  1. A. V(G) = 4, the number of bounded regions
  2. B. V(G) = 3, because V(G) = E - N
  3. C. V(G) = 5, counting the unbounded outer region as one of the regions
  4. D. V(G) = 6, because a single function adds 2 to the region count

Correct answer: C. V(G) = 5, counting the unbounded outer region as one of the regions

V(G) = E - N + 2 = 14 - 11 + 2 = 5. By Euler's formula the planar graph has 5 faces, of which 4 are bounded and 1 is the outer region; the region method counts the outer one too.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic