Question #1: Solution
Write Test requirements and Test cases required according to MCDC criteria.
1 2 3 4 5 | if ((A > 10) && (B < 5) || (C == 0)) { // Do something } else { // Do something else } |
Question #2:
Design a set of test cases to achieve 100% MCDC for the following C++ if statement:
1 2 3 4 5 | if ((X == 5) || (Y > 10) && (Z < 15)) { cout << "Condition passed"; } else { cout << "Condition failed"; } |
Question #3:
Write the minimal test cases required to achieve MCDC for the following C++ code:
1 2 3 4 5 | if ((A > 20) && (B < 30) || (C == 0) && (D != 5)) { cout << "Conditions met"; } else { cout << "Conditions not met"; } |
Question #4:
Generate test cases to achieve MCDC coverage for the following C++ if statement:
1 2 3 4 5 | if ((X == 5) && (Y < 5)) { cout << "Both conditions true"; } else { cout << "One or both conditions false"; } |
Question #5:
Write the test cases to achieve MCDC for the following C++ condition:
1 2 3 4 5 | if ((A > 5) && (B < 10) || (C == 0)) { cout << "Conditions met"; } else { cout << "Conditions not met"; } |
Question #6:
Generate the test cases to achieve MCDC for the following C++ ternary operator:
1 | (X > 5) ? (Y < 10) : (Z == 0); |
Question #7:
Design test cases to achieve MCDC for the following C++ decision:
1 2 3 4 5 | if ((A > 10) && (B < 5) || (C != 0)) { cout << "Valid condition"; } else { cout << "Invalid condition"; } |
Question #8:
Generate test cases to achieve MCDC for the following C++ code:
1 2 3 4 5 | if ((X == 5) && (Y > 10)) { cout << "Condition met"; } else { cout << "Condition not met"; } |