CS FundamentalsVery hardGATE CS · product placement

A function contains `if x > 5: A()` followed later by `if x < 3: B()`, and x is not changed between them. How many entry-to-exit paths are feasible, and what is V(G)?

  1. A. 4 feasible paths, V(G) = 3
  2. B. 3 feasible paths, V(G) = 3
  3. C. 3 feasible paths, V(G) = 2
  4. D. 2 feasible paths, V(G) = 3

Correct answer: B. 3 feasible paths, V(G) = 3

Of the 4 structural paths, x > 5 and x < 3 cannot both be true, so 3 are feasible. V(G) = 2 decisions + 1 = 3; basis-path testing can therefore produce an infeasible path, which testers must replace.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic