How many times does `for (int i = 0; i < 5; i++)` execute?
Selection and Iteration. Best move: $5$
The loop runs for $i=0,1,2,3,4$, which is five iterations.
Use a short diagnostic to expose the first decision that needs repair.
Answer from your current habits. The feedback points to a stronger exam-preparation move.
Selection and Iteration. Best move: $5$
The loop runs for $i=0,1,2,3,4$, which is five iterations.
Objects. Best move: Whether they refer to the same object
For object references, `==` tests reference identity, not equal field values.
Data Collections. Best move: It increases by one
Appending one element increases the list's size by one.
The published format is 42 questions on multiple choice and 4 questions on free response. Multiple choice - About 2.1 minutes each. Code-tracing items take longer than vocabulary items, so move fast on the short ones. Free response - About 22 minutes each. Write the method header first, then the return statement, then fill in the middle.
Start with the heaviest published weightings: Data Collections (30–40%), Selection and Iteration (25–35%), Using Objects and Methods (15–25%). Then repair whichever earlier unit those depend on.
Only where the exam allows one, and practising otherwise builds the wrong habit. Multiple choice: Arithmetic here is integer division and remainders you can do in your head. Free response: You write Java by hand on the exam. Practise without autocomplete or a compiler. Provided for the whole exam: String, Math, ArrayList, and Object methods are listed. Anything not on that sheet, you must remember.
Off-by-one errors on bounds. Arrays use .length, Strings use .length(), and ArrayLists use .size() - And valid indexes stop one below each of them.