CS FundamentalsHardTCS NQT · GATE CS

A function is:

A function is:
if (a > 0) x = 1;
if (b > 0) y = 1;
What is the minimum number of test cases for 100% branch (decision) coverage?
  1. A. 1
  2. B. 3
  3. C. 2
  4. D. 4

Correct answer: C. 2

One test with a>0 and b>0 takes both true branches, and one with both false takes both false branches, so 2 tests cover all four branch outcomes.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic