Solved

The Method FindMax Shown Below Is Supposed to Return the Position

Question 41

Multiple Choice

The method findMax shown below is supposed to return the position of the largest
Value in the portion of an array between 0 and last,inclusive:
Int findMax(int array[ ],int last) {
Int maxPos = 0;
For (int k = 1;k < = last;k++) {
// Code is Missing
}
Return maxPos;
}
The missing code is


A) if (array[k] > maxPos) return maxPos;
B) if (array[k] > array[maxPos].return maxPos;
C) if (array[k] > array[maxPos].maxPos = k;
D) if (array[k] > array[maxPos].k = maxPos;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions