Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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 image text in transcribed is supposed to find the sum of the highest two numbers in the given array image text in transcribed of positive integers. The program below contains an implementation of this function. Figure 1 displays a control flow graph of the program.

image text in transcribed

image text in transcribed

Based on the given implementation of the function image text in transcribed 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 image text in transcribed 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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago