MC/DC exercises with answers
Ten decisions for modified condition/decision coverage. For each, find an independence pair per condition, two test cases that differ in that condition only and give different outcomes, and count how many distinct test cases a set of such pairs needs. The engine's pairs are printed under each problem, with the truth table.
An independence pair for a condition holds every other condition fixed, flips that one, and shows the decision flip with it; the pair is the evidence that the condition matters on its own. For a decision with n conditions, n + 1 test cases are enough for every decision in this set when the pairs share rows, and the solutions state that count. Within an AND, the shared row is the one where every condition is TRUE; within an OR, the one where every condition is FALSE; mixed decisions combine the two patterns, and a condition under NOT simply flips its value.
The pairs the engine prints are chosen one condition at a time, so their union may use one row more than a hand-picked set that shares rows; both are correct MC/DC evidence, and the count in each solution is the shared-row count. Each printed pair is a complete assignment with the outcome, so you can find both rows in the truth table and replay them. A condition for which no pair exists would be reported as such; that happens when the decision never depends on it, which is a finding in itself.
1. Find an independence pair for each condition of (member OR invited) AND NOT banned and count the test cases needed. (member OR invited) AND NOT banned
| # | member | invited | banned | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | TRUE | FALSE | TRUE |
| 3 | FALSE | TRUE | TRUE | FALSE |
| 4 | TRUE | FALSE | FALSE | TRUE |
| 5 | TRUE | FALSE | TRUE | FALSE |
| 6 | TRUE | TRUE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | FALSE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
(member OR invited) AND NOT banned Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| member | found | member=F, invited=F, banned=F → F | member=T, invited=F, banned=F → T |
| invited | found | member=F, invited=F, banned=F → F | member=F, invited=T, banned=F → T |
| banned | found | member=F, invited=T, banned=F → T | member=F, invited=T, banned=T → F |
Three conditions, four test cases. Base all FALSE (no entry): flipping member alone or invited alone gives entry, which yields the pairs for member and invited; then member = FALSE, invited = TRUE, banned = FALSE (entry) against banned = TRUE with the same others (no entry) is the pair for banned. Rows used: all FALSE; member only; invited only; invited and banned.
2. Find an independence pair for each condition of armed AND (door OR window) and count the test cases needed. armed AND (door OR window)
| # | armed | door | window | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | TRUE | TRUE | FALSE |
| 4 | TRUE | FALSE | FALSE | FALSE |
| 5 | TRUE | FALSE | TRUE | TRUE |
| 6 | TRUE | TRUE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
armed AND (door OR window) Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| armed | found | armed=F, door=F, window=T → F | armed=T, door=F, window=T → T |
| door | found | armed=T, door=F, window=F → F | armed=T, door=T, window=F → T |
| window | found | armed=T, door=F, window=F → F | armed=T, door=F, window=T → T |
Three conditions, four test cases. For door and window, hold armed = TRUE and the other sensor FALSE, and flip the one under test: armed = TRUE, door = FALSE, window = FALSE (no alarm) is the shared row. For armed, hold one sensor TRUE and flip armed: armed = FALSE, door = TRUE, window = FALSE against armed = TRUE, door = TRUE, window = FALSE.
3. Find an independence pair for each condition of A AND (B OR C) and count the test cases needed. A AND (B OR C)
| # | A | B | C | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | TRUE | TRUE | FALSE |
| 4 | TRUE | FALSE | FALSE | FALSE |
| 5 | TRUE | FALSE | TRUE | TRUE |
| 6 | TRUE | TRUE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
A AND (B OR C) Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=F, C=T → F | A=T, B=F, C=T → T |
| B | found | A=T, B=F, C=F → F | A=T, B=T, C=F → T |
| C | found | A=T, B=F, C=F → F | A=T, B=F, C=T → T |
The same shape as the alarm rule: four test cases for three conditions. Pairs: for B, A = TRUE, B = FALSE, C = FALSE (FALSE) and A = TRUE, B = TRUE, C = FALSE (TRUE); for C, the same base with C flipped; for A, A = FALSE, B = TRUE, C = FALSE against A = TRUE, B = TRUE, C = FALSE.
4. Find an independence pair for each condition of (A OR B) AND (C OR D) and count the test cases needed. (A OR B) AND (C OR D)
| # | A | B | C | D | f |
|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | FALSE | TRUE | TRUE | FALSE |
| 4 | FALSE | TRUE | FALSE | FALSE | FALSE |
| 5 | FALSE | TRUE | FALSE | TRUE | TRUE |
| 6 | FALSE | TRUE | TRUE | FALSE | TRUE |
| 7 | FALSE | TRUE | TRUE | TRUE | TRUE |
| 8 | TRUE | FALSE | FALSE | FALSE | FALSE |
| 9 | TRUE | FALSE | FALSE | TRUE | TRUE |
| 10 | TRUE | FALSE | TRUE | FALSE | TRUE |
| 11 | TRUE | FALSE | TRUE | TRUE | TRUE |
| 12 | TRUE | TRUE | FALSE | FALSE | FALSE |
| 13 | TRUE | TRUE | FALSE | TRUE | TRUE |
| 14 | TRUE | TRUE | TRUE | FALSE | TRUE |
| 15 | TRUE | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
(A OR B) AND (C OR D) Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=F, C=F, D=T → F | A=T, B=F, C=F, D=T → T |
| B | found | A=F, B=F, C=F, D=T → F | A=F, B=T, C=F, D=T → T |
| C | found | A=F, B=T, C=F, D=F → F | A=F, B=T, C=T, D=F → T |
| D | found | A=F, B=T, C=F, D=F → F | A=F, B=T, C=F, D=T → T |
Four conditions, five test cases. Make one side TRUE with a single condition and flip the conditions of the other side one at a time: with C = TRUE, D = FALSE, the rows A = FALSE, B = FALSE (FALSE), A = TRUE, B = FALSE and A = FALSE, B = TRUE (both TRUE) give the pairs for A and B; with A = TRUE, B = FALSE, the rows C = FALSE, D = FALSE, C = TRUE, D = FALSE and C = FALSE, D = TRUE give the pairs for C and D. The row A = TRUE, B = FALSE, C = TRUE, D = FALSE is shared, so five rows in all.
5. Find an independence pair for each condition of A AND B AND C and count the test cases needed. A AND B AND C
| # | A | B | C | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | TRUE | TRUE | FALSE |
| 4 | TRUE | FALSE | FALSE | FALSE |
| 5 | TRUE | FALSE | TRUE | FALSE |
| 6 | TRUE | TRUE | FALSE | FALSE |
| 7 | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
A AND B AND C Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=T, C=T → F | A=T, B=T, C=T → T |
| B | found | A=T, B=F, C=T → F | A=T, B=T, C=T → T |
| C | found | A=T, B=T, C=F → F | A=T, B=T, C=T → T |
Four test cases: the all-TRUE row (TRUE) paired with each row that has exactly one condition FALSE (all FALSE). The all-TRUE row is shared by the three pairs.
6. Find an independence pair for each condition of A OR B OR C and count the test cases needed. A OR B OR C
| # | A | B | C | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | TRUE |
| 2 | FALSE | TRUE | FALSE | TRUE |
| 3 | FALSE | TRUE | TRUE | TRUE |
| 4 | TRUE | FALSE | FALSE | TRUE |
| 5 | TRUE | FALSE | TRUE | TRUE |
| 6 | TRUE | TRUE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
A OR B OR C Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=F, C=F → F | A=T, B=F, C=F → T |
| B | found | A=F, B=F, C=F → F | A=F, B=T, C=F → T |
| C | found | A=F, B=F, C=F → F | A=F, B=F, C=T → T |
Four test cases, the dual of the previous problem: the all-FALSE row (FALSE) paired with each row that has exactly one condition TRUE (all TRUE).
7. Find an independence pair for each condition of (A AND B) OR C and count the test cases needed. (A AND B) OR C
| # | A | B | C | f |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | TRUE | TRUE |
| 2 | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | TRUE | TRUE | TRUE |
| 4 | TRUE | FALSE | FALSE | FALSE |
| 5 | TRUE | FALSE | TRUE | TRUE |
| 6 | TRUE | TRUE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
(A AND B) OR C Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=T, C=F → F | A=T, B=T, C=F → T |
| B | found | A=T, B=F, C=F → F | A=T, B=T, C=F → T |
| C | found | A=F, B=F, C=F → F | A=F, B=F, C=T → T |
Four test cases. With C = FALSE, the rows A = TRUE, B = TRUE (TRUE), A = FALSE, B = TRUE and A = TRUE, B = FALSE (both FALSE) give the pairs for A and B; for C, hold A = FALSE, B = TRUE and flip C: C = FALSE (FALSE) against C = TRUE (TRUE). The printed pairs may pick a different base for C and use five rows; both choices are valid.
8. Find an independence pair for each condition of A XOR B and count the test cases needed. A XOR B
| # | A | B | f |
|---|---|---|---|
| 0 | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | TRUE |
| 2 | TRUE | FALSE | TRUE |
| 3 | TRUE | TRUE | FALSE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
A XOR B Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| A | found | A=F, B=F → F | A=T, B=F → T |
| B | found | A=F, B=F → F | A=F, B=T → T |
Three test cases for two conditions: from A = FALSE, B = FALSE (FALSE), flipping A gives A = TRUE, B = FALSE (TRUE) and flipping B gives A = FALSE, B = TRUE (TRUE). With XOR every single flip changes the outcome, so any row can serve as the shared base.
9. Find an independence pair for each condition of start AND guard_closed AND NOT (estop OR fault) and count the test cases needed. start AND guard_closed AND NOT (estop OR fault)
| # | start | guard_closed | estop | fault | f |
|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | FALSE | TRUE | TRUE | FALSE |
| 4 | FALSE | TRUE | FALSE | FALSE | FALSE |
| 5 | FALSE | TRUE | FALSE | TRUE | FALSE |
| 6 | FALSE | TRUE | TRUE | FALSE | FALSE |
| 7 | FALSE | TRUE | TRUE | TRUE | FALSE |
| 8 | TRUE | FALSE | FALSE | FALSE | FALSE |
| 9 | TRUE | FALSE | FALSE | TRUE | FALSE |
| 10 | TRUE | FALSE | TRUE | FALSE | FALSE |
| 11 | TRUE | FALSE | TRUE | TRUE | FALSE |
| 12 | TRUE | TRUE | FALSE | FALSE | TRUE |
| 13 | TRUE | TRUE | FALSE | TRUE | FALSE |
| 14 | TRUE | TRUE | TRUE | FALSE | FALSE |
| 15 | TRUE | TRUE | TRUE | TRUE | FALSE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
start AND guard_closed AND NOT (estop OR fault) Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| start | found | start=F, guard_closed=T, estop=F, fault=F → F | start=T, guard_closed=T, estop=F, fault=F → T |
| guard_closed | found | start=T, guard_closed=F, estop=F, fault=F → F | start=T, guard_closed=T, estop=F, fault=F → T |
| estop | found | start=T, guard_closed=T, estop=F, fault=F → T | start=T, guard_closed=T, estop=T, fault=F → F |
| fault | found | start=T, guard_closed=T, estop=F, fault=F → T | start=T, guard_closed=T, estop=F, fault=T → F |
Four conditions, five test cases. The running row start = TRUE, guard_closed = TRUE, estop = FALSE, fault = FALSE is the shared base; flipping any one condition from it stops the machine, which gives all four pairs at once. A condition under NOT is handled the same way: its flip is from FALSE to TRUE.
10. Find an independence pair for each condition of income_ok AND (credit_ok OR guarantor) AND NOT bankrupt and count the test cases needed. income_ok AND (credit_ok OR guarantor) AND NOT bankrupt
| # | income_ok | credit_ok | guarantor | bankrupt | f |
|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | FALSE | TRUE | FALSE |
| 2 | FALSE | FALSE | TRUE | FALSE | FALSE |
| 3 | FALSE | FALSE | TRUE | TRUE | FALSE |
| 4 | FALSE | TRUE | FALSE | FALSE | FALSE |
| 5 | FALSE | TRUE | FALSE | TRUE | FALSE |
| 6 | FALSE | TRUE | TRUE | FALSE | FALSE |
| 7 | FALSE | TRUE | TRUE | TRUE | FALSE |
| 8 | TRUE | FALSE | FALSE | FALSE | FALSE |
| 9 | TRUE | FALSE | FALSE | TRUE | FALSE |
| 10 | TRUE | FALSE | TRUE | FALSE | TRUE |
| 11 | TRUE | FALSE | TRUE | TRUE | FALSE |
| 12 | TRUE | TRUE | FALSE | FALSE | TRUE |
| 13 | TRUE | TRUE | FALSE | TRUE | FALSE |
| 14 | TRUE | TRUE | TRUE | FALSE | TRUE |
| 15 | TRUE | TRUE | TRUE | TRUE | FALSE |
The engine found no law that shortens this expression; it is already as short as its rewriting laws can make it.
income_ok AND (credit_ok OR guarantor) AND NOT bankrupt Classification: contingent
| Input | Status | Independence pair (only that input changes) |
|---|---|---|
| income_ok | found | income_ok=F, credit_ok=F, guarantor=T, bankrupt=F → F | income_ok=T, credit_ok=F, guarantor=T, bankrupt=F → T |
| credit_ok | found | income_ok=T, credit_ok=F, guarantor=F, bankrupt=F → F | income_ok=T, credit_ok=T, guarantor=F, bankrupt=F → T |
| guarantor | found | income_ok=T, credit_ok=F, guarantor=F, bankrupt=F → F | income_ok=T, credit_ok=F, guarantor=T, bankrupt=F → T |
| bankrupt | found | income_ok=T, credit_ok=F, guarantor=T, bankrupt=F → T | income_ok=T, credit_ok=F, guarantor=T, bankrupt=T → F |
Four conditions, five test cases. Base income_ok = TRUE, credit_ok = TRUE, guarantor = FALSE, bankrupt = FALSE (granted): flipping income_ok, credit_ok or bankrupt alone refuses, three pairs sharing the base; for guarantor, hold credit_ok = FALSE with income ok and not bankrupt and flip guarantor: guarantor = FALSE (refused) against guarantor = TRUE (granted). The row income_ok = TRUE, credit_ok = FALSE, guarantor = FALSE, bankrupt = FALSE serves both the credit_ok pair and the guarantor pair.
Questions
Why is MC/DC stronger than decision coverage?
Decision coverage needs only one TRUE and one FALSE outcome, two tests, and it cannot tell A AND (B OR C) from A AND B. MC/DC asks for a pair per condition, so a condition that is wired wrong, or missing, fails to show its own effect; four tests expose it for that decision. The number of tests grows with the conditions, not with the rows.
Related
Testing and rules
- MC/DC vs condition coverage vs multiple condition coverage
- Condition coverage vs decision (branch) coverage
See also
- MC/DC explained: modified condition/decision coverage for Boolean rules
- MC/DC independence pairs, worked example with the engine’s coverage report
- Independence pair in MC/DC: meaning and examples
- MC/DC (modified condition/decision coverage): meaning and examples
- Alarm rule: armed AND (door OR window OR motion) AND NOT disarm_code
Practice
Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.