I am preparing for a testing certification. These types of questions are asked frequently.
Example 1:
Read P
Read Q
IF P+Q > 100 THEN
Print “Large”
ENDIF
If P > 50 THEN
Print “P Large”
ENDIF
Example 2:
READ X
READ Y
I F X>Y THEN Z = 0
ENDIF
Example 3:
1 READ X
2 READ Y
3 Z =X + 2*Y
4 IF Z> 50 THEN
5 PRINT large Z
6 ENDIF
What are Nodes and Edges in the flowchart?
Statement Coverage: 1A-2C-3D-E-4G-5H = 1
Branch Coverage: 1A-2C-3D-E-4G-5H , 1A-2B-E-4F = 2
Path Coverage: 4
1A-2B-E-4F
1A-2B-E-4G-5H
1A-2C-3D-E-4G-5H
1A-2C-3D-E-4F
Please explain , how the answers came by?
In these example, how do we identify that which is a statement, branch and condition? How do we measure coverage? Please give detailed explanations of ALL 3 examples.