Question
[Verification and Validation] The function is supposed to find the sum of the highest two numbers in the given array of positive integers. The program
[Verification and Validation]
The function is supposed to find the sum of the highest two numbers in the given array of positive integers. The program below contains an implementation of this function. Figure 1 displays a control flow graph of the program.
Based on the given implementation of the function and the control flow graph in Figure 1, answer the following questions.
1) Is there a test case which produces the following test path:
[1, 2, 4, 6, 7, 8, 9, 12, 13, 7, 8, 9, 12, 13, 7, 8, 10, 11, 12, 13, 7, 14] ?
If there is one, describe such a test case.
Note: Here, a test case can be described by a pair (s, x) where s is an array of integers to be given to the function and x is the number which the function is expected to return.
2) Suppose the test suite T consists of the following 3 test cases:
([], 0) ([1], 1) ([1, 2], 3)
2a) What are the test paths produced by the test cases in T.
2b) Does the test suite T satisfy node coverage? If so, explain why it does so. If not, find the degree of node coverage of this test suite and describe an extension of this test suite which has the highest degree of node coverage.
2c) Does the test suite T satisfy edge coverage? If so, explain why it does so. If not, find the degree of edge coverage of this test suite and describe an extension of this test suite which has the highest degree of edge coverage.
3) Is there a test suite which satisfies prime path coverage? If so, describe such a test suite and explain why it satisfies prime path coverage. If not, explain why there can be no test suite which satisfies prime path coverage and describe a test suite which has the highest degree of prime path coverage.
sumo fTopTwo(int[] scores)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started