Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← AP Computer Science A Not started
Simulate the decision-making

Prepare for the timed AP Computer Science A test.

Your answers are held until submission. The final review identifies the units that need another pass.

AP Computer Science A coverage and review map

Connect every question to the exact skill it rehearses. Work through the units in order, then return to any topic that still needs a hint or a second attempt.

01

Using Objects and Methods

Types, expressions, strings, methods, APIs

Goal: recognise a using objects and methods problem from its wording, carry out the governing method, and check that the result is reasonable.

02

Selection and Iteration

Boolean logic, conditionals, loops, algorithms

Goal: recognise a selection and iteration problem from its wording, carry out the governing method, and check that the result is reasonable.

03

Class Creation

Fields, constructors, methods, encapsulation

Goal: recognise a class creation problem from its wording, carry out the governing method, and check that the result is reasonable.

04

Data Collections

Arrays, ArrayList, 2D arrays, traversal, recursion

Goal: recognise a data collections problem from its wording, carry out the governing method, and check that the result is reasonable.

AP Computer Science A questions with worked answers

These 8 questions are printed in full on this page and are drawn across all 4 course units. Nothing here is generated on the fly. Cover the options, solve each one on paper, and only then open the worked answer to compare your method with the one shown.

Question 1: What does "Computer".substring(2, 5) return in Java?

AP Computer Science A · Using Objects and Methods

  1. "mpu"
  2. "ompu"
  3. "mput"
  4. "omp"
Show the worked answer
  1. Java counts string positions starting at 0.
  2. The first argument is the starting index, which is included.
  3. The second argument is the ending index, which is not included.
  4. Positions 2, 3, and 4 hold m, p, and u, so the result is "mpu".

Answer: "mpu"

Question 2: In Java, what are the values of 17 / 5 and 17 % 5 when both operands are ints?

AP Computer Science A · Using Objects and Methods

  1. 3 and 2
  2. 3.4 and 2
  3. 3 and 3.4
  4. 4 and 2
Show the worked answer
  1. Dividing two ints in Java performs integer division and throws away any fraction.
  2. 5 goes into 17 three whole times, so 17 / 5 is 3, not 3.4.
  3. The % operator returns the remainder.
  4. 3 x 5 = 15, and 17 - 15 = 2, so 17 % 5 is 2.

Answer: 3 and 2

Question 3: How many times does the loop for (int i = 1; i <= 10; i += 3) run, and what is the sum of the values of i?

AP Computer Science A · Selection and Iteration

  1. 4 times, sum 22
  2. 3 times, sum 12
  3. 4 times, sum 20
  4. 10 times, sum 55
Show the worked answer
  1. Start at i = 1 and add 3 each pass while i stays at or below 10.
  2. The values are 1, 4, 7, and 10.
  3. The next value would be 13, which fails the test, so the loop stops.
  4. That is 4 passes, and 1 + 4 + 7 + 10 = 22.

Answer: 4 times, sum 22

Question 4: An outer loop runs 4 times and contains an inner loop that runs 3 times. How many times does the innermost statement execute?

AP Computer Science A · Selection and Iteration

  1. 12
  2. 7
  3. 4
  4. 3
Show the worked answer
  1. The inner loop completes all of its passes during each single pass of the outer loop.
  2. So the count is outer passes times inner passes.
  3. 4 x 3 = 12.
  4. The innermost statement runs 12 times.

Answer: 12

Question 5: What does the keyword 'this' refer to inside a Java instance method?

AP Computer Science A · Class Creation

  1. The object the method was called on
  2. The class itself rather than any object
  3. The parent class of the object
  4. A copy of the object's parameters
Show the worked answer
  1. Every instance method runs on behalf of one particular object.
  2. 'this' is a reference to that object.
  3. It is commonly used when a parameter has the same name as an instance variable, as in this.name = name.
  4. It never refers to the class as a whole, which is what static members belong to.

Answer: The object the method was called on

Question 6: An array holds {3, 8, 1, 9}. A loop compares each element to a running maximum that starts at the first element. What is the final value?

AP Computer Science A · Data Collections

  1. 9
  2. 8
  3. 3
  4. 21
Show the worked answer
  1. Start with the maximum set to the first element, 3.
  2. 8 is larger than 3, so the maximum becomes 8.
  3. 1 is smaller, so nothing changes.
  4. 9 is larger than 8, so the maximum becomes 9, and that is the final answer.

Answer: 9

Question 7: An ArrayList holds ["A", "B", "C", "D"]. What is left after calling remove(1) twice?

AP Computer Science A · Data Collections

  1. ["A", "D"]
  2. ["A", "C"]
  3. ["C", "D"]
  4. ["A", "B"]
Show the worked answer
  1. The first remove(1) deletes "B", the element at index 1.
  2. The list shifts left and becomes ["A", "C", "D"].
  3. Index 1 now holds "C", so the second remove(1) deletes it.
  4. The list is ["A", "D"]. This shifting is a common source of bugs when removing inside a loop.

Answer: ["A", "D"]

Question 8: How many elements does the array created by int[][] grid = new int[3][4] hold in total?

AP Computer Science A · Data Collections

  1. 12
  2. 7
  3. 34
  4. 3
Show the worked answer
  1. The declaration makes 3 rows.
  2. Each row is an array of 4 ints.
  3. Multiply rows by columns: 3 x 4.
  4. That is 12 elements, and every one starts at the default value 0.

Answer: 12

Which unit each printed question belongs to

Use this map after marking your work. If two misses share a unit, review that unit before starting a generated set.

The 8 printed AP Computer Science A questions, the unit each one tests, and its answer.
QuestionUnitWhat it asksAnswer
1Using Objects and MethodsWhat does "Computer".substring(2, 5) return in Java?"mpu"
2Using Objects and MethodsIn Java, what are the values of 17 / 5 and 17 % 5 when both operands are ints?3 and 2
3Selection and IterationHow many times does the loop for (int i = 1; i <= 10; i += 3) run, and what is the sum of the values of i?4 times, sum 22
4Selection and IterationAn outer loop runs 4 times and contains an inner loop that runs 3 times. How many times does the innermost statement execute?12
5Class CreationWhat does the keyword 'this' refer to inside a Java instance method?The object the method was called on
6Data CollectionsAn array holds {3, 8, 1, 9}. A loop compares each element to a running maximum that starts at the first element. What is the final value?9
7Data CollectionsAn ArrayList holds ["A", "B", "C", "D"]. What is left after calling remove(1) twice?["A", "D"]
8Data CollectionsHow many elements does the array created by int[][] grid = new int[3][4] hold in total?12

How the generated AP Computer Science A sets are created

The 8 questions above are fixed and checked. The generator at the top of the page is different: it writes fresh questions with AI from the course and unit information shown here, then the application checks each one for a complete prompt, four choices, one keyed answer, and an explanation. Generated questions are original practice—not official or released exam questions—and AI can still make mathematical mistakes. Verify a disputed answer with the stated method, your course materials, or the MathGPT solver, and follow the site's academic-integrity guidance.

Questions about this AP Computer Science A course test

What does this page cover?

It covers all 4 AP Computer Science A units listed above.

When can I see correct answers and explanations?

Submit the full test first. The result screen then shows every response, the correct answer, and the explanation so you can review each miss.

How long is each section of the AP Computer Science A exam?

Multiple choice: 1 hour 30 minutes, 42 questions. Free response: 1 hour 30 minutes, 4 questions.

Which AP Computer Science A sections allow a calculator?

Rules change from section to section. Multiple choice: no calculator. Free response: no calculator. Provided for the whole exam: Java Quick Reference. Practise each section under its own rule.

Which AP Computer Science A units does this test cover?

All four: Using Objects and Methods, Selection and Iteration, Class Creation, Data Collections. Study first: Data Collections (30–40%) carries the largest published weighting.

What should I check first when I review a missed AP Computer Science A question?

Comparing Strings or objects with ==. That compares references. Use .equals for content.

What should I do with a missed question?

Classify the miss as a definition, setup, calculation, interpretation, or timing error. Re-solve it from a blank page, then use the MathGPT tutor for a hint or method check.