AP Computer Science A Question of the Day

Test your knowledge with a hand-picked multiple-choice question.

Suppose you are given the following lines of code (and x is some initialized integer):

int k = arr.length;

for (int i = -1; i <k-2; i++)

{

if (arr<u>i+2</u> < x)

System.out.print("Hello");

}

What is the maximum number of times "Hello" print?

Select an answer and click Check.
1 taken
0 correct
1 incorrect