CS FundamentalsVery hardGATE CS · product placement

A function is a straight sequence of three independent if-else statements, with no loops. What are (total entry-to-exit paths, cyclomatic complexity, minimum tests for 100% branch coverage)?

  1. A. (8, 4, 2)
  2. B. (8, 4, 4)
  3. C. (6, 3, 2)
  4. D. (8, 3, 8)

Correct answer: A. (8, 4, 2)

Independent choices multiply: 2^3 = 8 paths. V(G) = 3 decisions + 1 = 4 basis paths. Two tests suffice for branches: one taking every 'if' side and one taking every 'else' side. Paths grow exponentially, branches only linearly.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic