Exam strategy
Knowing Java is most of the battle. These habits turn that knowledge into points under time pressure. Try them out in a mock exam.
Section I · Multiple choice
Pace yourself
Section I is 42 questions in 90 minutes, a little over 2 minutes each.
- If a question stalls you, mark it, guess, and move on. Come back if time is left.
- There is no penalty for wrong answers. Never leave a bubble blank.
- Eliminate choices you know are wrong before tracing in detail.
Trace with a pencil, not in your head
- For each loop pass, write down the loop variable and every variable that changes.
- Think small: when code works on an array or String, try a 3-element array or a 3-letter word.
- If the answer depends on n, try n = 2 or 3 and look for the pattern.
- For recursion, write each call on its own line, reach the base case, then substitute back up.
- For a 2D array algorithm, check the top-left and bottom-right cells first. That often rules out most choices.
Loop questions
- Check < versus <= carefully. They change the count by one.
- Check the update. It is not always i++; watch for i += 2, i *= 2, or a change inside the body.
- Count the iterations by listing the values the loop variable takes.
- For nested loops, multiply if the bounds are independent and add pass by pass if they aren't.
"What's wrong with this code?" checklist
- Can an index reach arr.length, list.size(), or str.length()? That's out of bounds.
- Does the code use arr[i + 1] with i going to the last index?
- Does substring have start > end, or end > length()?
- Is a private variable or method being used from outside its class?
- Is == used to compare Strings or other objects?
- Does a return inside a loop (in an else) end the loop too early?
- Is something removed from an ArrayList while looping forward with i++?
- Does a recursive method have a base case that is actually reached?
- Is an int divided by an int where a double result was expected?
Exception choices
- ArrayIndexOutOfBoundsException (arrays), IndexOutOfBoundsException (ArrayList), StringIndexOutOfBoundsException (String).
- ArithmeticException comes from int division or % by zero.
- NullPointerException comes from calling a method on null, including an unfilled array of objects.
- Check short-circuiting: with && and ||, the risky part may never run.
I, II, and III questions
- Decide each option on its own: does it compile, and does it do exactly what's asked?
- As soon as one option is settled, cross out every answer choice that disagrees.
- If two options look identical, find the one-character difference.
Section II · Free response
Plan your 90 minutes
Section II is four questions in 90 minutes, about 22 minutes each.
- Skim all four first and start with the one you're most confident about.
- Underline return types, parameter names, and the methods you're given.
- Each part is graded on its own. Do part (b) even if you couldn't finish part (a), and call the part (a) method as if it works.
What the question types expect
- Q1 Methods and Control Structures: loops and conditionals that call the class's methods, plus String methods in part (b).
- Q2 Class Design: the class header, private instance variables, a constructor that sets every variable, and methods matching the example table exactly.
- Q3 Data Analysis with ArrayList: traverse a list of objects, call their getters, and often add or remove elements.
- Q4 2D Array: nested loops over rows and columns, with bounds checks for neighbors.
Write code readers can score
- Use the names in the question: the same method names, parameter names, and instance variables.
- Use the methods you're given. Rewriting their logic by hand can cost points.
- Return values; don't print them unless the question asks for output.
- Don't change parameters or data the method shouldn't change.
- Write one solution. If you start over, cross the first one out clearly; only the first uncrossed attempt is graded.
- Don't spend time on comments or on making working code more elegant.
Partial credit is real
- Points are awarded per rubric item. A correct loop over all elements can earn a point even if the logic inside is off.
- If you're stuck, write the parts you know: the header, the traversal, the getter calls.
- Small slips such as a missing semicolon, length vs. size(), or [] vs. get() usually aren't penalized when the intent is clear.