Question: [Verification and Validation] Consider the following implementation of the function findMin which takes an array of integers as input and returns an integer value which,

[Verification and Validation]

Consider the following implementation of the function findMin which takes an array of integers as input and returns an integer value which, supposedly, is the minimum element in the array.

[Verification and Validation] Consider the following implementation of the function findMin which

1) Draw a control flow graph of this function in which each node n in the graph is labeled with the set Def(n) and the set Use(n), where

Def(n) = the set of variables which are defined (i.e. they are assigned some values) at node n.

Use(n) = the set of variables which are accessed (i.e. their values are read) at node n.

Note: In this function, the variables that we are interested in are arr, min, and i.

2) Find a smallest set of test paths in your graph which satisfies All-Defs coverage. Is there a set of test input which produces your set of test paths? If there is one, describe such a set of test input.

3) Find a smallest set of test paths in your graph which satisfies All-Uses coverage. Is there a set of test input which produces your set of test paths? If there is one, describe such a set of test input.

public int findMin (int[] array) t 1: 2 3 if array. length = 0) return -1; int min = array [0] ; int i=0; while( 1array. length) { 5 6 7 8 9 10: if (min array[1]) min = array[1] return min; 12: public int findMin (int[] array) t 1: 2 3 if array. length = 0) return -1; int min = array [0] ; int i=0; while( 1array. length) { 5 6 7 8 9 10: if (min array[1]) min = array[1] return min; 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!