AP Computer Science Aeasymcq1 pt
Which loop correctly visits every element of array a?
A.for (int i = 0; i < a.length; i++)
B.for (int i = 0; i ≤ a.length; i++)
C.for (int i = 1; i < a.length; i++)
D.for (int i = a.length; i > 0; i--)
The loop covers indexes 0 to length minus one.
Afor (int i = 0; i < a.length; i++)
Practice more AP Computer Science A questions with full explanations
Practice Unit 6: Array Questions →