GATE / CS ARCHIVE

GATE CSE 2010 / QUESTION 21

Cyclomatic complexity of sequential composition

Engineering Mathematics & Other Topics · Software Engineering · Full GATE CSE 2010 paper

GATE 2010, Q21 1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Software Engineering

Question 21, GATE 2010: Modules A and B each have cyclomatic complexity 10. The combined flow executes A and then B in sequence, with no additional branch between them. What is the cyclomatic complexity of this sequential integration?
Options: (A) 19; (B) 21; (C) 20; (D) 10.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

For a connected single-entry/single-exit flow graph, cyclomatic complexity is the number of decision points plus one. Complexity 10 in each component means nine independent decisions each. Sequentially composing them adds their decision counts but introduces only one overall baseline path: 9+9+1=19. Equivalently V(A;B)=V(A)+V(B)−1, so A.

The flow-graph formula gives the same result. Connecting A’s exit to B’s entry adds one edge while leaving N_A+N_B vertices. Thus E−N+2=(E_A−N_A+2)+(E_B−N_B+2)−1=19. Simply adding 10+10 counts the straight-through baseline path twice.

Original paper, page 5