AP CSA Cheat Sheet 2026
The 30 highest-yield AP CSA facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
40 questions
90 min time limit
60% to pass
- What is the purpose of the `@Override` annotation in Java? → It tells the compiler to verify the method actually overrides a superclass method
- What is the output of: `public void count(int n){ if(n==0) return; System.out.print(n+" "); count(n-1); }` called with count(3)? → 3 2 1
- What is the index of the first element in a Java array? → 0
- Which of the following correctly initializes an array in Java? → int arr = {1, 2, 3};
- What is the length of an array declared as `int[] arr = new int[5];`? → 5
- How do you fill an entire 2D array `grid` of size n×m with the value 0? → Declare it as `int[][] grid = new int[n][m]` (auto-initialized to 0)
- What happens if you try to store a double value in an int array in Java? → Compile-time error
- If class Dog extends Animal and both have a `speak()` method, what does `Animal a = new Dog(); a.speak();` call? → Dog's speak() method
- In the AP CSA exam, what is the standard way to search for a value in an unsorted ArrayList? → Sequential (linear) search
- How many passes does selection sort make over an array of n elements? → n-1
- How many comparisons does binary search make in the worst case on an array of 16 elements? → 4
- If a subclass constructor does not explicitly call `super()`, what happens in Java? → Java automatically inserts a call to the no-argument superclass constructor
- What is the term for when a superclass method calls an overridden method that runs the subclass version? → Polymorphic dispatch
- What keyword does a subclass use to inherit from a superclass in Java? → extends
- What is the base case in a recursive method? → The condition that stops the recursion
- How many times will the following loop execute? → 5
- What is the recursive case? → The part of the method that makes a call to itself with a smaller/simpler input
- What is the output of a correctly implemented binary search when the target is not in the array in AP CSA conventions? → -1
- Which of the following are common mistakes to avoid in AP CSA? → Forgetting to close loops or braces (}) in your code.
- Which of the following best describes the purpose of an interface in Java? → To define a contract specifying what methods a class must implement
- Which keyword does a class use to adopt an interface? → implements
- What does `Arrays.sort(arr)` use internally in Java for primitive arrays? → A variant of quicksort (dual-pivot quicksort)
- In a 2D array, what does `matrix[0].length` represent? → The number of columns in row 0
- Can a subclass inherit from multiple superclasses in Java? → No, Java only supports single inheritance for classes
- What is the result of `int[] arr = {3, 1, 4, 1, 5}; System.out.println(arr[2]);`? → 4
- What is the result of trying to instantiate an abstract class directly? → A compile-time error
- In the Fibonacci sequence defined recursively as fib(n)=fib(n-1)+fib(n-2), what are the base cases? → fib(0)=0 and fib(1)=1
- Consider: `public abstract class Shape { public abstract double area(); }`. Which of the following correctly creates a subclass? → public class Circle extends Shape { public double area() { return 3.14 * r * r; } }
- Which ArrayList method removes the first occurrence of a specified object? → remove(Object o)
- Which of the following best describes mutual recursion? → Two methods that each call the other
Turn these facts into recall: