Professional Documents
Culture Documents
Assignment #3 ST (70109028)
Assignment #3 ST (70109028)
SAP ID : 70109028
Section : 8-D
ASSIGNMENT #3.
Exercise 1: How many tests are required to achieve 100% statement coverage?
To achieve 100% statement coverage for the given code, we need to execute all statements at
least once. In this case, we have the following statements:
1. If Age \( <17 \)
3. Else
5. End if
The statement coverage requires each statement to be executed at least once. Looking at the
flowchart provided:
If A is greater than or equal to 17, the program will display 'customer OK.'
1. Age < 17: In this case, statements 1 and 2 will be executed, and statements 3, 4, and 5 will not
be executed.
2. Age >= 17: In this case, statements 1 and 3 will be executed, and statements 2, 4, and 5 will
not be executed.
3. Age >= 17: In this case, statements 1, 3, 4, and 5 will be executed, and statement 2 will not be
executed.
Therefore, the minimum number of tests required to achieve 100% statement coverage for the
given code is two.
Exercise 2: How many tests are required to achieve 100% statement coverage?
Rationale:
To achieve 100% statement coverage, each statement in the code must be executed at least once
during testing.
The diagram provided shows the different statements and their connections.
2. To cover all statements, you need to test for both "y" and "n" conditions at each decision point.
3. Therefore, you need to test for "y" and "n" at points 2 and 3, which leads to a total of 4 tests (2
tests at point 2 and 2 tests at point 3).