ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 89 - CTAL-TTA discussion

Report
Export

Given the following code:

If x > y and z = 3 statement!

elseif z = 4 statement

endif;

What is the minimum number of tests needed to achieve 100% decision coverage?

A.
1
Answers
A.
1
B.
2
Answers
B.
2
C.
3
Answers
C.
3
D.
4
Answers
D.
4
Suggested answer: B

Explanation:

To achieve 100% decision coverage, you must ensure every decision in the code has been evaluated both to true and false. Given the code:

If x > y and z = 3 statement1 elseif z = 4 statement2 endif;

Two tests are required:

Test 1: Set x > y true and z = 3 to evaluate the first decision as true and execute statement1.

Test 2: Set z = 4 (ensuring the first condition x > y and z = 3 evaluates to false) to evaluate the elseif condition as true and execute statement2.

This testing ensures that both branches of the decision have been evaluated.

asked 18/09/2024
Pritish Verma
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first