Back to the 2025 paper

Module 3: Software Design & Metrics

20252m

Cyclomatic Complexity is primarily used to measure:

(i) Lines of code
(ii) Logical paths in a program
(iii) Execution speed
(iv) Code documentation quality

Worked SolutionAI Assisted

Answer: (ii) Logical paths in a program

Cyclomatic complexity (McCabe, 1976) is a software metric that measures the number of linearly independent paths through a program's control-flow graph — i.e., the number of logical decision paths (loops, conditionals) that must be tested. It is computed as

V(G)=E−N+2V(G) = E - N + 2

where EE = number of edges, NN = number of nodes of the control-flow graph (equivalently V(G)=P+1V(G) = P + 1, where PP = number of predicate/decision nodes).

Its main uses:

  • Determines the minimum number of test cases required to achieve branch/path coverage.
  • Indicates the complexity/testability of a module — high complexity means more paths, more testing, and higher defect potential.

Why the others are wrong:

  • (i) Lines of code — that is a size measure (LOC), not cyclomatic complexity.
  • (iii) Execution speed — a performance concern, unrelated.
  • (iv) Code documentation quality — a maintainability/documentation concern, unrelated.

So cyclomatic complexity primarily measures logical paths in a program — option (ii).

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.