Consider the following statements: i. 100% statement coverage guarantees 100% branch coverage. ii. 100% branch coverage guarantees 100% statement coverage. iii. 100% branch coverage guarantees 100% decision coverage. iv. 100% decision coverage guarantees 100% branch coverage. v. 100% statement coverage guarantees 100% decision coverage.
-
a) ii is True; i, iii, iv & v are False
-
b) i & v are True; ii, iii & iv are False
-
c) ii & iii are True; i, iv & v are False
-
d) ii, iii & iv are True; i & v are False
Statement coverage measures lines executed; branch coverage requires testing both branches of each decision; decision coverage is equivalent to branch coverage. 100% branch coverage guarantees 100% statement coverage (ii is True) because executing every branch means executing every statement. Branch and decision coverage are equivalent (iii, iv are True). However, 100% statement coverage doesn't guarantee branch coverage (i, v are False) - you can execute all statements without testing both branches of every if-else.
To answer this question, we need to understand the concepts of statement coverage, branch coverage, and decision coverage.
Statement coverage: It measures the percentage of statements in the code that have been executed during testing.
Branch coverage: It measures the percentage of branches (or decision points) in the code that have been executed during testing. A branch is a point in the code where there are multiple possible paths or choices.
Decision coverage: It measures the percentage of decision outcomes that have been executed during testing. A decision outcome refers to the different possible results of a decision point or branch.
Now let's go through each statement to determine if it is true or false:
i. 100% statement coverage guarantees 100% branch coverage. This statement is false. Although 100% statement coverage ensures that all statements have been executed, it doesn't guarantee that all branches have been covered.
ii. 100% branch coverage guarantees 100% statement coverage. This statement is false. While 100% branch coverage ensures that all branches have been executed, it doesn't guarantee that all statements have been covered.
iii. 100% branch coverage guarantees 100% decision coverage. This statement is true. If all branches have been executed, then all possible decision outcomes must have been covered as well.
iv. 100% decision coverage guarantees 100% branch coverage. This statement is false. Although 100% decision coverage ensures that all decision outcomes have been executed, it doesn't guarantee that all branches have been covered.
v. 100% statement coverage guarantees 100% decision coverage. This statement is false. While 100% statement coverage ensures that all statements have been executed, it doesn't guarantee that all decision outcomes have been covered.
Based on the explanations above, the correct answer is:
D) ii, iii & iv are True; i & v are False.