Exam CTFL All QuestionsBrowse all questions from this exam
Question 11

Consider the following pseudo code:

1. Begin

2. Input X, Y

3. If X > Y

4. __Print (X, is greater than, Y)

5. Else

6. __Print (Y, is greater than or equal to, X)

7. EndIf

8. End

What is the minimum number of test cases required to guarantee both 100% statement coverage and 100% decision coverage?

    Correct Answer: B

    In the given pseudocode, to achieve 100% statement coverage and 100% decision coverage, we need to ensure that every line of the code and every branch of the decision is executed at least once. We need to test both paths of the decision (i.e., when X > Y and when X <= Y). This can be done with 2 test cases, one where X is greater than Y and one where X is less than or equal to Y. Hence, the minimum number of test cases required to guarantee both 100% statement coverage and 100% decision coverage is 2.

Discussion
69pawan6969Option: C

I believe C is more appropriate

laraerfOption: C

C is correct

MthethoOption: D

D. Statement coverage = 2, Decision coverage = 1

Prasanth25

Should we treat reading 2 variables are 2 statements?