Given a flow graph with 10 nodes, 13 edges and one connected components, the…

2013

Given a flow graph with 10 nodes, 13 edges and one connected components, the number of regions and the number of predicate (decision) nodes in the flow graph will be

Answer: B. 5, 4Formula: V = E - N + 2P (cyclomatic complexity, which equals the number of regions for a connected flow graph). Given: edges E = 13, nodes N = 10, connected…

  1. A.

    4, 5

  2. B.

    5, 4 

  3. C.

    3, 1

  4. D.

    13, 8

Attempted by 127 students.

Show answer & explanation

Correct answer: B

Formula: V = E - N + 2P (cyclomatic complexity, which equals the number of regions for a connected flow graph).

Given: edges E = 13, nodes N = 10, connected components P = 1.

  1. Compute the number of regions (cyclomatic complexity): V = 13 - 10 + 2*1 = 5.

  2. Compute the number of predicate (decision) nodes: For a single connected flow graph, each decision increases V by 1, so predicate nodes = V - 1 = 5 - 1 = 4.

Answer: number of regions = 5, number of predicate (decision) nodes = 4.

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…