in IS&Software Engineering retagged by
2,487 views
2 votes
2 votes

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

  1. The number of regions $-1$ 
  2. $E – N + 1$, where $E$ is the number of flow graph edges and $N$ is the number of flow graph nodes.
  3. $P – 1$, where $P$ is the number of predicate nodes in the flow graph $G$. 
  4. $P + 1$, where $P$ is the number of predicate nodes in the flow graph $G$. 
in IS&Software Engineering retagged by
2.5k views

1 Answer

1 vote
1 vote
Best answer

Cyclomatic complexity is a metric to measure logical complexity of a program.

  • Cyclomatic complexity defines the number of independent paths in a program
  • It gives an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once
  • An independent path is any path through the program that introduces at least one new set of processing statements or a new condition.     

Cyclomatic complexity is computed in one of three ways:

1. The number of regions of the flow graph
2. Cyclomatic complexity, V(G), for a flow graph, G, is defined as V(G) = E - N+ 2k where E is the number of flow graph edges, N is the number of flow graph nodes and k is the number of connected components or number of exit points.

3. V(G) = P+ 1 where P is the number of predicate (condition) nodes contained in the flow graph G.

Answer (D)

selected by
by
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true