Which one of the following statements is incorrect?
2012
Which one of the following statements is incorrect?
- A.
The number of regions corresponds to the cyclomatic complexity.
- B.
Cyclomatic complexity for a flow graph G is V(G) = N − E + 2, where E is the number of edges and N is the number of nodes in the flow graph.
- C.
Cyclomatic complexity for a flow graph G is V(G) = E − N + 2, where E is the number of edges and N is the number of nodes in the flow graph.
- D.
Cyclomatic complexity for a flow graph G is V(G) = P + 1, where P is the number of predicate nodes contained in the flow graph G.
Attempted by 67 students.
Show answer & explanation
Correct answer: B
The incorrect statement is Option B. For a connected flow graph, cyclomatic complexity is V(G) = E - N + 2, where E is the number of edges and N is the number of nodes. Equivalently, V(G) = P + 1, where P is the number of predicate nodes, and the number of regions also corresponds to V(G). Option B reverses E and N by stating V(G) = N - E + 2, so it is the false statement.
A video solution is available for this question — log in and enroll to watch it.