Quality Testing

Quality is delighting customers

Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage?

Read p
Read q
IF p+q > 100 THEN
Print ""Large""
IF p > 50 THEN
Print "p Large"

a) 1 test for statement coverage, 3 for branch coverage
b) 1 test for statement coverage, 2 for branch coverage
c) 1 test for statement coverage, 1 for branch coverage
d) 2 tests for statement coverage, 2 for branch coverag

Views: 271

Reply to This

Replies to This Discussion

Hi KK,

Option d is correct.

-S Sarita
HI Kiran,

The option is a.

Best Regards,
What is the correct ans KK ji?
I think correct answer is "D"
D - is the correct answer
@ Sarita, Rashmi, Malini,

Could you please explain the answer in detail why correct ans is 'd' ? thanks!
Correct answer is D
Correct answer is B: 1 test for statement coverage, 2 for branch coverage
Hi Kiran,

To exercise p + q > 100 & p > 50

I have considered these values.
1) p = 40, q = 50
2) p = 50 , q = 60
3) p = 60, q = 40
4) p = 60, q = 50

that's how i concluded it to be option a.

Best Regards,

Correct answer is (b) 1 test for statement coverage, 2 for branch coverage

This is been asked in ISTQB exam as well

Hi Pooja,

Thanks for your reply.

Best Regards,
Hi Mohan ...

Thanks for explaining this ........ I gave the answer as per ISTQB .....

"100% decision coverage always means 100% statement coverage" -- that's true ...

But Decision coverage measures the coverage of conditional branches and Branch coverage measure both conditional and unconditional branshes.

And at 100% coverage they will exactly the same results



TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service