ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 54 - CTAL-TTA discussion

Report
Export

Consider the pseudo code provided below:

Given the following tests, what additional test(s) (if any) would be needed in order to achieve 100% statement coverage, with the minimum number of tests?

Test 1: A = 7, B = 7, Expected output: 7

Test 2: A = 7, B = 5, Expected output: 5

A.
A=6, B=12, Expected output: Bingo! and A=7, B=9, Expected output: 7
Answers
A.
A=6, B=12, Expected output: Bingo! and A=7, B=9, Expected output: 7
B.
A=6, B=12, Expected output: Bingo!
Answers
B.
A=6, B=12, Expected output: Bingo!
C.
A=7, B=9, Expected output: 7
Answers
C.
A=7, B=9, Expected output: 7
D.
No additional test cases are needed to achieve 100% statement coverage.
Answers
D.
No additional test cases are needed to achieve 100% statement coverage.
Suggested answer: D

Explanation:

100% statement coverage means that every line of code is executed at least once during testing. Based on the provided pseudo-code and the test cases given:

Test 1 executes the MIN = B statement when A and B are equal.

Test 2 executes the MIN = A statement and skips the inner IF since B is not equal to 2*A.

All statements within the code have been executed by these two tests, hence no additional test cases are needed to achieve 100% statement coverage.

asked 18/09/2024
Rob Kennis
31 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first