For practice use only.
Full-Length APCSA MCQ Practice Test 1 - Practice Mode
Full-Length APCSA MCQ Practice Test 1 in practice mode with per-question answer checks and explanations.
Question 1 of 42
Answered 0 of 42
Choose one answer.
Compare the candidate replacements by tracing both a typical input and a boundary input. Account explicitly for index accumulator, indirect comparison, and global versus local minimum. minIndex must return the position of the smallest element of a non-empty array. Which condition replaces /* missing code */ ?
public static int minIndex(int[] a)
{
int best = 0;
for (int i = 1; i < a.length; i++)
{
if (/* missing code */)
{
best = i;
}
}
return best;
}