Open In App

UGC-NET | UGC NET CS 2014 Dec – II | Question 45

Which one of the following is used to compute cyclomatic complexity?
(A) The number of regions – 1
(B) E – N + 1, where E is the number of flow graph edges and N is the number of flow graph nodes.
(C) P – 1, where P is the number of predicate nodes in the flow graph G.
(D) P + 1, where P is the number of predicate nodes in the flow graph G.

Answer: (D)
Explanation: Cyclomatic complexity is a software metric used to measure the complexity of a program. These metric, measures independent paths through program source code.
Mathematically, it is set of independent paths through the graph diagram. The complexity of the program can be defined as –
V(G) = E – N + 2
Where, E – Number of edges
N – Number of Nodes
V (G) = P + 1
Where P = Number of predicate nodes (node that contains condition)
for more information on Cyclomatic complexity Refer: What is Cyclomatic Complexity? Explain with a flow graph
Option (D) is correct.
Quiz of this Question

Article Tags :