ExamGecko
Question list
Search
Search

Related questions











Question 253 - CTFL-2018 discussion

Report
Export

Considering the following pseudo-code, calculate the MINIMUM number of test cases required to achieve 100% statement coverage and 100% decision coverage.

A.
Statement coverage: 4, Decision coverage: 5
Answers
A.
Statement coverage: 4, Decision coverage: 5
B.
Statement coverage. 3. Decision coverage 4
Answers
B.
Statement coverage. 3. Decision coverage 4
C.
Statement coverage 4. Decision coverage 4
Answers
C.
Statement coverage 4. Decision coverage 4
D.
Statement coverage: 4. Decision coverage: 3
Answers
D.
Statement coverage: 4. Decision coverage: 3
Suggested answer: C

Explanation:

To achieve 100% statement coverage, we need to execute every statement in the code at least once. To achieve 100% decision coverage, we need to execute every possible outcome of every decision in the code at least once. In this case, we can use the following test cases to cover both statement and decision coverage:

A = 5, B = 4, C = 3, D = 2, E = 1

A = 1, B = 2, C = 3, D = 4, E = 5

A = 3, B = 4, C = 5, D = 2, E = 1

A = 3, B = 2, C = 1, D = 4, E = 5

These four test cases will cover all the statements and all the possible outcomes of the decisions in the code. Therefore, the minimum number of test cases required to achieve both statement and decision coverage is four.

asked 18/09/2024
Gerhard Seher
28 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first