How many test cases are needed for the code fragment lines 26 – 37 to achieve 100% modified condition/decision coverage?

Consider the code fragment provided below:

How many test cases are needed for the code fragment lines 26 – 37 to achieve 100% modified condition/decision coverage?
A . 2 test cases
B . 4 test cases
C . 6 test cases
D . 8 test cases

Answer: B

Explanation:

Modified condition/decision coverage (MC/DC) requires each condition in a decision to be shown to independently affect the decision’s outcome. For the code fragment provided, we have three independent conditions that need to be evaluated both as true and false. The minimum number of test cases needed to satisfy MC/DC for three conditions is four, which would allow each condition to be shown to independently affect the outcome of the decision.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments