Question #1: Solution
Write Test requirements and Test cases required according to MCDC criteria.
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:
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:
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:
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:
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:
(X > 5) ? (Y < 10) : (Z == 0);
Question #7:
Design test cases to achieve MCDC for the following C++ decision:
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:
if ((X == 5) && (Y > 10)) {
cout << "Condition met";
} else {
cout << "Condition not met";
}