CS FundamentalsVery hardProduct company interview · GATE level

What is the minimum number of test cases that achieves MC/DC (unique-cause modified condition/decision coverage: for every condition, two tests that differ only in that condition and give different decision outcomes) for the decision (A || B) && (C || D)?

  1. A. 4
  2. B. 5
  3. C. 8
  4. D. 16

Correct answer: B. 5

MC/DC for n independent conditions needs at least n + 1 tests, here 5, and a brute-force search over all subsets of the 16 combinations confirms that 5 suffice and 4 do not. One minimal set, written as values of A B C D: 0001 (false), 0100 (false), 0101 (true), 0110 (true), 1001 (true). The pairs 0001/1001 show A, 0001/0101 show B, 0100/0110 show C and 0100/0101 show D - each pair differs in exactly one condition and flips the outcome. 4 tests cannot supply four such pairs; 16 is exhaustive testing and 8 is the common overestimate of two fresh tests per condition.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic