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
  1. What is the purpose of the `@Override` annotation in Java? It tells the compiler to verify the method actually overrides a superclass method
  2. 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
  3. What is the index of the first element in a Java array? 0
  4. Which of the following correctly initializes an array in Java? int arr = {1, 2, 3};
  5. What is the length of an array declared as `int[] arr = new int[5];`? 5
  6. 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)
  7. What happens if you try to store a double value in an int array in Java? Compile-time error
  8. If class Dog extends Animal and both have a `speak()` method, what does `Animal a = new Dog(); a.speak();` call? Dog's speak() method
  9. In the AP CSA exam, what is the standard way to search for a value in an unsorted ArrayList? Sequential (linear) search
  10. How many passes does selection sort make over an array of n elements? n-1
  11. How many comparisons does binary search make in the worst case on an array of 16 elements? 4
  12. If a subclass constructor does not explicitly call `super()`, what happens in Java? Java automatically inserts a call to the no-argument superclass constructor
  13. What is the term for when a superclass method calls an overridden method that runs the subclass version? Polymorphic dispatch
  14. What keyword does a subclass use to inherit from a superclass in Java? extends
  15. What is the base case in a recursive method? The condition that stops the recursion
  16. How many times will the following loop execute? 5
  17. What is the recursive case? The part of the method that makes a call to itself with a smaller/simpler input
  18. What is the output of a correctly implemented binary search when the target is not in the array in AP CSA conventions? -1
  19. Which of the following are common mistakes to avoid in AP CSA? Forgetting to close loops or braces (}) in your code.
  20. Which of the following best describes the purpose of an interface in Java? To define a contract specifying what methods a class must implement
  21. Which keyword does a class use to adopt an interface? implements
  22. What does `Arrays.sort(arr)` use internally in Java for primitive arrays? A variant of quicksort (dual-pivot quicksort)
  23. In a 2D array, what does `matrix[0].length` represent? The number of columns in row 0
  24. Can a subclass inherit from multiple superclasses in Java? No, Java only supports single inheritance for classes
  25. What is the result of `int[] arr = {3, 1, 4, 1, 5}; System.out.println(arr[2]);`? 4
  26. What is the result of trying to instantiate an abstract class directly? A compile-time error
  27. 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
  28. 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; } }
  29. Which ArrayList method removes the first occurrence of a specified object? remove(Object o)
  30. Which of the following best describes mutual recursion? Two methods that each call the other
Turn these facts into recall: