Which of the following options provides a set of test cases that achieves 100% decision coverage for this code fragment, with the minimum number of test cases?
Consider the pseudo code provided below:
Which of the following options provides a set of test cases that achieves 100% decision coverage for this code fragment, with the minimum number of test cases?
Assume that in the options, each of the three numbers in parenthesis represent the inputs for a test case, where the first number represents variable “a”, the second number represents variable “b”, and the third number represents variable “c”.
A . (5. 3,2)
B . (5. 3, 2); (6, 4, 2); (5, 4, 0)
C . (5. 4, 0); (3, 2, 5); (4, 5, 0)
D . (4,5. 0); {5, 4, 5)
Answer: B
Explanation:
To achieve 100% decision coverage with the minimum number of test cases, we need to ensure that every branch of the decision is taken at least once. For the code provided:
The first condition (a>b) is true for the first two test cases and false for the third.
The second condition (b>c) is true for the first test case, false for the second, and does not matter for the third since the first condition is false.
Therefore, with these three test cases, we cover all possible outcomes of the decision, ensuring 100% decision coverage.
Latest CTAL-TTA Dumps Valid Version with 65 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund