Question 30Asked in UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)

Which one of the following is used to compute cyclomatic complexity?

  1. AThe number of regions–1
  2. BE – N + 1 , where E is the number of flow graph edges and N is the number of flow graph nodes
  3. CP – 1, where P is the number of predicate nodes in the flow graph G.
  4. DP + 1, where P is the number of predicate nodes in the flow graph G.
Show answerHide answer

Correct answer: (D) P + 1, where P is the number of predicate nodes in the flow graph G.

Explanation

Cyclomatic complexity measures the logical complexity of a program (the number of independent paths). It can be computed as: (1) the number of regions of the flow graph; (2) V(G) = E – N + 2, where E is the number of edges and N the number of nodes; (3) V(G) = P + 1, where P is the number of predicate nodes in the flow graph G.

From UGC NET Computer Science PYQ, December 2014 (Paper II & III, Selected Questions)

This is question 30 of UGC NET Computer Science PYQ, December 2014 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.