Skip to content

ISRO Scientist/Engineer CSE 2023Information Systems and Software Engineering › Software Testing and Complexity Metrics

ISRO Scientist/Engineer CSE 2023 PYQ: McCabe's cyclomatic complexity number of a program control graph 'G' with e edges, $n$ nodes and $p$…

McCabe's cyclomatic complexity number of a program control graph 'G' with e edges, $n$ nodes and $p$ disconnected paths is defined as

  1. A
    $\mathrm{n}-\mathrm{e}+2 \mathrm{p}$
  2. B
    $\mathrm{e}-\mathrm{n}+2+\mathrm{p}$
  3. C
    $e-n+2 p$
    Correct answer
  4. D
    $\mathrm{n}-\mathrm{e}+\mathrm{p}$

Answer

(C) $e-n+2 p$

Approach

Recall the standard definition of McCabe's cyclomatic complexity for a control flow graph with e edges, n nodes, and p connected components (disconnected paths). The formula is V(G) = e - n + 2p.

Reviewed by ISRO IQ Editorial Team.