AP Computer Science A practice test: free Java questions, exam format and 2027 date
AP Computer Science A
Start today's paperPaper resets in
The daily AP Computer Science A paper has 8 original questions worth 25 to 35 marks. Be clear about the fit: it is practice for the ideas behind AP CSA, such as object-oriented programming, recursion, data structures, searching and sorting. Its code is mostly Python rather than Java, and it also covers processors, databases, networks and other topics that AP CSA doesn't test. Use it alongside Java practice, not instead of it.
AP Computer Science A exam format for 2027
| Section | Questions | Share of score |
|---|---|---|
| I: Multiple choice | 42, single questions with occasional sets of 2 | 55% |
| II: Free response | 4, written Java code | 45% |
| Total | 46, in 3 hours | 100% |
The exam is fully digital: you answer both sections in the Bluebook app, and your answers are submitted automatically at the end. Calculators are not allowed, and College Board provides reference materials. The four free-response questions are always the same types:
- Methods and Control Structures: create objects, call methods, and use conditions and loops to meet a specification.
- Class Design: write a complete class with its constructor and methods.
- Data Analysis with ArrayList: create, traverse and change an ArrayList.
- 2D Array: create, traverse and change a 2D array.
AP Computer Science A units
| Unit | Share of exam score |
|---|---|
| 1. Using Objects and Methods | 15% to 25% |
| 2. Selection and Iteration | 25% to 35% |
| 3. Class Creation | 10% to 18% |
| 4. Data Collections | 30% to 40% |
Data collections (arrays, ArrayLists, 2D arrays, searching, sorting and recursion) is the biggest unit at up to 40%, and two of the four free-response questions are built on it. College Board recommends high school English and algebra first, and describes the course as a one-semester introductory college course in computer science. Write and run Java-style logic in the Code Editor and watch sorting algorithms in the Algorithm Visualiser.
AP Computer Science A practice test questions
We wrote these for this page. Each targets something the multiple-choice section tests often: tracing code exactly as Java runs it.
1. Integer division
System.out.println(7 / 2 + 7 % 2);
System.out.println((double) 7 / 2);Answer: the first line prints 4: 7 / 2 is 3 because dividing two ints drops the remainder, and 7 % 2 is 1. The second prints 3.5, because the cast makes 7 a double before the division.
2. Strings
String s = "precalculus";
System.out.println(s.substring(3, 6));Answer: cal. Indexes start at 0, and substring(3, 6) returns characters 3, 4 and 5: it stops before the end index.
3. Loops
int sum = 0;
for (int i = 1; i <= 10; i += 3)
{
sum += i;
}
System.out.println(sum);Answer: 22. i takes the values 1, 4, 7 and 10, and 1 + 4 + 7 + 10 = 22. The loop runs while i <= 10, so 10 is included.
4. Removing from an ArrayList
ArrayList<Integer> nums = new ArrayList<Integer>();
nums.add(4); nums.add(6); nums.add(6); nums.add(9);
for (int i = 0; i < nums.size(); i++)
{
if (nums.get(i) % 2 == 0)
{
nums.remove(i);
}
}
System.out.println(nums);Answer: [6, 9]. Removing 4 shifts every later element left, so the first 6 moves to index 0, but i has already moved on to 1 and skips it. To remove every even number, loop backward from the end, which leaves [9]. This exact pattern comes up in ArrayList questions.
5. Binary search
Question: What is the greatest number of times a binary search must check an element of a sorted array of 500 ints?
Answer: 9. Each check halves what is left, and 2⁹ = 512 is the first power of 2 above 500. A linear search could need all 500. Try a halving question from our Search Algorithms course, then press Mark.
Type log base 2 of a list size, or the list size from a number of halvings.
Press Mark to have your answer marked in the Search Algorithms course.
6. Recursion
public static int stack(int k)
{
if (k == 0)
{
return 3;
}
return stack(k - 1) + 2;
}Question: What does stack(4) return? Answer: 11. Work back from the base case: stack(0) = 3, stack(1) = 5, stack(2) = 7, stack(3) = 9 and stack(4) = 11. Writing each call on its own line stops you losing track.
Scores, date and deadlines
In 2026, 25% of AP Computer Science A students scored 5, 26% scored 4, 15% scored 3, 11% scored 2 and 23% scored 1, so 66% scored 3 or higher. Each college sets its own credit policy.
- Exam: Wednesday, May 12, 2027, in the afternoon session, at 12 p.m. local time in the lower 48 states, Hawaii and Washington, D.C.
- Ordering deadline: November 13, 2026, through your school's AP coordinator. Your school may set an earlier date.
- Fee: $99 in the US, US territories and Canada, $129 elsewhere, plus $40 for exams ordered from November 14 to March 12.
- Scores: released in July 2027.
Use the daily paper as a short timed practice test
- Open today's AP Computer Science A paper and work to the suggested time, 35 to 40 minutes.
- Answer the object-oriented, recursion, data structure and sorting questions, and rewrite any code answer in Java afterward.
- Treat the processor, database and networking questions as extra: AP CSA doesn't test them.
- Spend the rest of your practice writing Java methods by hand for the four free-response types.
Common AP Computer Science A mistakes
- Forgetting that int division drops the remainder.
- Off-by-one loop bounds: < size() versus <= size().
- Removing from an ArrayList while looping forward.
- Comparing Strings with == instead of equals.
- Mixing up rows and columns in a 2D array: arr[row][col], and arr.length is the number of rows.
- Leaving out the base case in a recursive method.
Common questions
How long is the AP Computer Science A exam?
What language is AP Computer Science A in?
Can you use a calculator on AP Computer Science A?
Are these real AP Computer Science A questions?
Revision cards
Test yourself, then flip each card to check.
Where to go next
- Solve it
Code Editor
Write and run code right in your browser
Open the tool - Learn it
Search Algorithms
Linear, binary, depth-first and beyond: find data fast with the right algorithm
Start the course - Test it
AP Computer Science A
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper