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;


C) if (array[k] > array[maxPos]) maxPos = k;

Computer Science & Information Technology

You might also like to view...

A(n) ________ is a small symbol that precedes information in a list

Fill in the blank(s) with correct word

Computer Science & Information Technology

When you import data from Microsoft Access to a PivotTable Report, the ________ placeholder displays on the left side of the worksheet and the PivotTable Fields pane displays on the right

A) Data Model B) PivotTable Fields C) PivotChart D) PivotTable

Computer Science & Information Technology

What is the result of the CD /WINDOWS command?

A) The prompt changes to C:\WINDOWS >. B) The DOCUMENTS directory is created on a disk. C) The WINDOWS directory is created on the hard drive. D) Nothing. The command is invalid.

Computer Science & Information Technology

Answer the following questions true (T) or false (F)

1. True/False: Comments are ignored by the computer when the program executes. 2. True/False: A single-alternative selection structure always contains an Else clause. 3. True/False: The assignment operator and the comparison operator are the same.

Computer Science & Information Technology