AP CS A Course AP CS Principles 1-on-1 Tutoring Blog
← Back to Blog
AP CS A

Most Common AP CS A Mistakes (and How to Avoid Them)

By Namrata Poladia April 14, 2026

As a College Board AP Reader, I've scored thousands of AP Computer Science A exams. The same mistakes come up year after year, and they're almost always avoidable. This post covers the errors I see most often, with code examples and concrete fixes so you don't lose points on exam day.

1. Using == to Compare Strings

This is the single most common mistake on the AP CS A exam. In Java, == compares object references (whether two variables point to the same object in memory), not the actual content of the strings.

// WRONG
if (name == "Alice") { ... }

// CORRECT
if (name.equals("Alice")) { ... }

The rule: use == for primitives (int, double, boolean) and .equals() for objects (String, Integer, or any class). This also applies to wrapper classes: comparing two Integer objects with == can give unexpected results.

2. Off-by-One Errors in Loops

Off-by-one errors are the most common source of lost points on FRQs. They usually come from confusion about whether to use < or <=, or starting at the wrong index.

// WRONG: ArrayIndexOutOfBoundsException
for (int i = 0; i <= arr.length; i++) { ... }

// CORRECT
for (int i = 0; i < arr.length; i++) { ... }

Remember: arrays and ArrayLists are zero-indexed. The last valid index is length - 1 (for arrays) or size() - 1 (for ArrayLists). When in doubt, trace through your loop with a small example (an array of size 2 or 3) and verify the first and last iterations are correct.

3. Modifying an ArrayList While Looping Forward

This is a trap that catches students every year. When you remove an element from an ArrayList while iterating forward, the remaining elements shift left. This causes you to skip the next element.

// WRONG: skips elements after removal
for (int i = 0; i < list.size(); i++) {
    if (list.get(i).equals("remove")) {
        list.remove(i);
    }
}

// CORRECT: loop backward
for (int i = list.size() - 1; i >= 0; i--) {
    if (list.get(i).equals("remove")) {
        list.remove(i);
    }
}

// ALSO CORRECT: decrement i after removal
for (int i = 0; i < list.size(); i++) {
    if (list.get(i).equals("remove")) {
        list.remove(i);
        i--;
    }
}

Why looping backward works: when you remove an element at index i, elements shift left starting at i + 1. Since you're moving toward index 0, the shifted elements are ones you've already processed.

4. Returning Too Early Inside a Loop

Students often place a return statement inside a loop when it should be outside. This causes the method to return after checking only the first element.

// WRONG: returns after checking only the first element
public boolean containsNegative(int[] arr) {
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] < 0) {
            return true;
        } else {
            return false;  // BUG: exits on the first non-negative element
        }
    }
    return false;
}

// CORRECT: only return false after checking ALL elements
public boolean containsNegative(int[] arr) {
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] < 0) {
            return true;
        }
    }
    return false;
}

The pattern: when searching for something in an array, you can return true as soon as you find it. But you can only return false after the entire loop finishes without finding it.

5. Confusing Array Length Syntax

Java is inconsistent about how you get the size of different data structures, and the exam tests this directly.

Data Structure How to Get Size Note
Arrayarr.lengthNo parentheses (it's a field)
Stringstr.length()Parentheses (it's a method)
ArrayListlist.size()Different method name entirely

Writing arr.length() or list.length() will not compile, and AP readers will deduct points. Memorize these three.

6. Forgetting to Handle Edge Cases

Many FRQ solutions work correctly for typical input but break on edge cases. The most common ones to check for:

  • Empty arrays or ArrayLists: does your code handle size() == 0 without crashing?
  • Single-element collections: does your comparison logic work when there's only one item?
  • First and last elements: if you're comparing adjacent elements, make sure you don't go out of bounds at the start or end.
  • All elements the same: if you're searching for a maximum or minimum, does your code still work when every value is identical?
  • Null values: if the problem mentions that elements could be null, check before calling methods on them.

Tip: after writing your solution, mentally run through it with an empty input and an input of size 1. This takes 30 seconds and catches a surprising number of bugs.

7. Not Using Given Helper Methods

FRQ problems often provide helper methods or tell you that certain methods exist in a class. Students lose points by rewriting this logic instead of calling the provided method.

For example, if the problem says "the isValid method returns true if the position is within bounds," then use it:

// WRONG: reimplementing logic the problem already gave you
if (row >= 0 && row < grid.length && col >= 0 && col < grid[0].length) { ... }

// CORRECT: use the provided method
if (isValid(row, col)) { ... }

AP readers specifically check whether you use the methods the problem provides. Using them also makes your code shorter and less error-prone.

8. Incorrect 2D Array Traversal

2D arrays appear on almost every AP CS A exam. The most common mistakes are mixing up rows and columns, and using the wrong length for inner vs. outer loops.

// Standard row-major traversal
for (int row = 0; row < grid.length; row++) {
    for (int col = 0; col < grid[row].length; col++) {
        // process grid[row][col]
    }
}

Key things to remember:

  • grid.length gives the number of rows
  • grid[0].length (or grid[row].length) gives the number of columns
  • Access is always grid[row][col], never grid[col][row]
  • For column-major traversal, swap the loop order: outer loop iterates over columns, inner loop over rows

9. Ignoring the Return Type

When writing FRQ methods, students sometimes forget to return a value, return the wrong type, or modify an object when the problem asks them to create a new one.

Before writing any code, look at the method signature carefully:

  • If the return type is void, you should be modifying something in place
  • If the return type is int, String, ArrayList, etc., make sure you actually return a value of that type on every possible code path
  • If the problem says "return a new ArrayList," don't modify the original

10. Poor Time Management on FRQs

This isn't a coding mistake, but it costs more points than any single bug. Students spend too long perfecting parts (a) and (b), then run out of time and leave parts (c) and (d) blank.

A better approach:

  1. Read all four FRQs before writing anything (2 minutes)
  2. Budget roughly 20 minutes per FRQ
  3. If you're stuck on a part, write your best attempt and move on. Partial credit adds up: a 5/9 on every question is far better than 9/9 on two and 0/9 on two.
  4. If a later part depends on an earlier part, you can assume the earlier part works correctly. Write your solution using the method from part (a) even if you're not confident your part (a) is correct. You'll still earn full credit on part (b) if your logic is right.

Quick Reference: Exam Day Checklist

Before submitting each FRQ, run through this mental checklist:

  • == vs .equals(): am I comparing objects correctly?
  • Loop bounds: does my loop start and end at the right index?
  • ArrayList removal: am I looping backward or adjusting the index?
  • Return placement: is my return false outside the loop?
  • Helper methods: did I use the methods the problem gave me?
  • Edge cases: does my code handle empty input?
  • 2D arrays: is it grid[row][col] with the correct lengths?

Want to Practice These in a Live Setting?

In ExamReadyUSA's 4-week AP CS A Crash Course, we work through these exact mistakes with real FRQ problems. Each student writes code, gets it reviewed, and gets personal written feedback on graded homework. Groups are capped at 5 students, and the course is taught by Namrata Poladia, a College Board AP Reader who knows exactly what costs points on the exam.