ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 87 - CTAL-TTA discussion

Report
Export

Given the following code:

If x > y and z = 3 statement!

elself z = 4

statement2

endif;

What is the minimum number of tests needed to achieve 100% statement 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% statement coverage, you need to ensure every executable statement in the code is executed at least once during testing. Given the code:

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

Two tests are required:

Test 1: Set x > y and z = 3 to execute statement1.

Test 2: Set z = 4 (irrespective of the condition x > y) to execute statement2.

With these two tests, both conditions that lead to the execution of statement1 and statement2 are covered.

asked 18/09/2024
Charl Grove
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first