Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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.

image text in transcribed

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

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 is the meaning and definition of E-Business?

Answered: 1 week ago