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?
- A. V(G) = 4, the number of bounded regions
- B. V(G) = 3, because V(G) = E - N
- C. V(G) = 5, counting the unbounded outer region as one of the regions
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- How many of these statements about coverage criteria are correct? 1. 100% branch coverage guarantees 100% statement coverage. 2. 100%…
- In Java, the non-short-circuit operator | evaluates both sides. For if ((a > 0) | (b > 0)) { X(); } else { Y(); } the tests (a = 1, b =…
- With short-circuit evaluation, how many distinct evaluation patterns (which conditions are evaluated and their values) can the decision (A…
- A loop can execute between 0 and 10 times (n = 10). Following Beizer's guidelines for simple-loop testing, which set of iteration counts…
- A function is a straight sequence of three independent if-else statements, with no loops. What are (total entry-to-exit paths, cyclomatic…
- How many definition-use (def-use) pairs does variable x have in this fragment (a p-use in a condition counts as a use)? python x =…