I have seen the following question in an ISTQB - Foundation Level sample paper.
Q. 12: If the pseudo code below were a programming language ,how many tests are required to achieve 100% statement coverage?
- If x=3 then
- Display_messageX;
- If y=2 then
- Display_messageY;
- Else
- Display_messageZ;
- Else
- Display_messageZ;
Answers
A. 1
B. 2
C. 3
D. 4
I believe that the answer is 2 because you can cover all the Statements by covering the following paths.
- A,B,C,E,D,G
- A,B,F,G
However, many web sites (please find a list of sites at the end) say that the answer is 3.
I have two questions :
- Is there anything wrong with my flowchart?
- Why is my answer incorrect?
Links to the places where it says that 3 is the correct answer