# Thread: I cant get the correct answer to this question regarding control flow diagrams

1. ## I cant get the correct answer to this question regarding control flow diagrams

Apologies if this is in the wrong section but I need to know this answer ASAP:

If you are flying with an economy ticket, there is a possibility that you may get upgraded to business class, especially if you hold a gold card in the airline's frequent flier program. If you don't hold a gold card, there is a possibility that you will get 'bumped' off the flight if it is full and you check in late. This is shown in Figure 4.5. Note that each box (i.e. statement) has been numbered.
Three tests have been run:
Test 2: Non-gold card holder who stays in economy Test 3: A person who is bumped from the flight What is the statement coverage of these three tests?
a. 60%
b. 70%
c. 80%
d. 90%

Please click this link for the control flow diagram: Statement Coverage calculation though flow diagram

I can only seem to get 70% as to me it looks like this.
Test 1 executes boxes 2,4
Test2 executes boxes 6,7
Test 3 executes boxes 6,8,10

Can someone explain the step I am missing?

2. Originally Posted by df88
Apologies if this is in the wrong section but I need to know this answer ASAP:

If you are flying with an economy ticket, there is a possibility that you may get upgraded to business class, especially if you hold a gold card in the airline's frequent flier program. If you don't hold a gold card, there is a possibility that you will get 'bumped' off the flight if it is full and you check in late. This is shown in Figure 4.5. Note that each box (i.e. statement) has been numbered.
Three tests have been run:
Test 2: Non-gold card holder who stays in economy Test 3: A person who is bumped from the flight What is the statement coverage of these three tests?
a. 60%
b. 70%
c. 80%
d. 90%

Please click this link for the control flow diagram: Statement Coverage calculation though flow diagram

I can only seem to get 70% as to me it looks like this.
Test 1 executes boxes 2,4
Test2 executes boxes 6,7
Test 3 executes boxes 6,8,10

Can someone explain the step I am missing?

Test1 - 1->2->4->5
Test2 - (1)->6->7->(5)
Test3 - (1)->(6)->8->10

3. Originally Posted by dlai
Test1 - 1->2->4->5
Test2 - (1)->6->7->(5)
Test2 - (1)->(6)->8->10
Thanks for that, looks like I really messed it up - do you mind explaining how you got your answer and why the steps in the brackets are not counted?

4. Or do you not count the statement boxes executed in the previous tests?

5. Originally Posted by df88
Or do you not count the statement boxes executed in the previous tests?
That's basically it. In statement coverage you just cared if the statement is touched or not. It's not like branch coverage where you care about the actual code path or data flow coverage where you care about which statement side effects.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.