Cyclomatic complexity of the flow graph given below is __________.

2026

Cyclomatic complexity of the flow graph given below is __________.

image.png

  1. A.

    5

  2. B.

    6

  3. C.

    4

  4. D.

    3

Attempted by 53 students.

Show answer & explanation

Correct answer: C

Cyclomatic complexity can be calculated using the formula: V(G) = P + 1, where P is the number of predicate nodes (decision nodes with out-degree > 1).

In the given flow graph, the decision nodes are 2, 3, and 4. Node 2 branches to 3 and 4. Node 3 branches to 5 and 6. Node 4 branches to 7 and 8.

Since there are 3 decision nodes, the cyclomatic complexity is 3 + 1 = 4.

Explore the full course: Hpsc Pgt Computer Science