AP COMPUTER SCIENCE · CODE, DATA, SYSTEMS, AND IMPACT

AP Computer Science Practice Test

Build AP Computer Science readiness with five focused practice sets combining AP Computer Science A Java programming with the current 2026–27 AP Computer Science Principles framework: objects, control, classes, collections, data, algorithms, networks, security, impact, and responsible computing.

AP Computer Science practice sets

College Board offers separate AP Computer Science A and AP Computer Science Principles courses. This supplemental page brings both tracks together in five practice sets: three Java-focused CSA booklets and two current-framework CSP booklets.

CSA and CSP skills

  • AP Computer Science A Units 1–4: using objects and methods; selection and iteration; class creation; data collections including ArrayList and two-dimensional arrays
  • AP Computer Science A practices: design code, develop code, analyze code, and document code and computing systems
  • AP Computer Science Principles Big Ideas 1–5: creative development; data; algorithms and programming; computer systems and networks; and impact of computing
  • AP Computer Science Principles practices: computational solution design, algorithms and program development, abstraction, code analysis, computing innovations, and responsible computing
  • Code, binary, powers, indexes, and data calculations use the system’s supported notation where mathematical display is needed

How to use this page

For Java questions, trace types, references, method calls, control flow, indexes, and object state before choosing an answer. For CSP questions, identify the representation, abstraction, algorithm, network behavior, evidence, or social impact. These are original supplemental questions, not official College Board questions, secure exam content, Bluebook forms, or a substitute for current College Board policies.

The AP Computer Science A course page lists the current Java units and computational thinking practices. The AP Computer Science A exam page describes the current fully digital Java exam and Quick Reference. The AP Computer Science Principles course page lists the current 2026–27 Big Ideas and practices. The AP CSP exam page describes the current end-of-course exam and Create performance task.

College Board has announced an AP CSP redesign for 2027–28. This page targets the current 2026–27 AP CSP framework for the May 2027 administration; review the official redesign information before preparing for a later course year.

For additional preparation, visit AP Statistics Practice, AP Physics Practice, Computer Science and Technology Tests, or use Pomodoro for focused study intervals.

2. Test

AP Computer Science Practice Questions

A 10-question AP Computer Science practice set focused on ap computer science a: classes, inheritance, and collections with original code, data, algorithms, and computing-impact explanations.

Trace code carefully, identify data representations and abstractions, evaluate algorithms and systems, and consider responsible computing impacts. Review the three-step explanation after answering. These questions are original supplemental practice, not official College Board questions.

10 Questions
0/100%
Reading settings
Reading settings
Text size
18px
Line spacing
1.70
C 0I 0U 10
1. QuestionMultiple choice

What is printed by int sum = 0; for (int i = 1; i <= 4; i++) sum += i;?

Please select an answer first.

Correct answer: B

The correct answer is 10.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: The loop adds 1, 2, 3, and 4, giving 1 + 2 + 3 + 4 = 10.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

The loop adds 1, 2, 3, and 4, giving 1 + 2 + 3 + 4 = 10.

2. QuestionMultiple choice

A while loop can fail to terminate when

Please select an answer first.

Correct answer: C

The correct answer is its condition remains true because the loop control state never changes appropriately.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: A loop needs a condition that eventually becomes false; failing to update the control state can cause an infinite loop.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

A loop needs a condition that eventually becomes false; failing to update the control state can cause an infinite loop.

3. QuestionMultiple choice

How many times does the inner statement execute? for (int r = 0; r < 3; r++) for (int c = 0; c < 2; c++) count++;

Please select an answer first.

Correct answer: D

The correct answer is 6.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: The inner loop runs 2 times for each of 3 outer-loop iterations, so the statement executes 3×23 \times 2 = 6 times.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

The inner loop runs 2 times for each of 3 outer-loop iterations, so the statement executes 3×23 \times 2 = 6 times.

4. QuestionMultiple choice

A private instance variable in a class primarily supports

Please select an answer first.

Correct answer: A

The correct answer is encapsulation by limiting direct access to the variable.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: Private data is hidden from direct access outside the class and can be controlled through methods such as getters and setters.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

Private data is hidden from direct access outside the class and can be controlled through methods such as getters and setters.

5. QuestionMultiple choice

If a subclass defines a method with the same signature as an inherited method, the subclass method

Please select an answer first.

Correct answer: B

The correct answer is overrides the inherited method.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: Overriding replaces inherited behavior for calls that use the subclass implementation and matching signature.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

Overriding replaces inherited behavior for calls that use the subclass implementation and matching signature.

Numicorn

A Numicorn tip

Share it and study together

Share the page with a friend, solve questions together and keep moving forward.

6. QuestionMultiple choice

The keyword super is used in a subclass to

Please select an answer first.

Correct answer: C

The correct answer is refer to members or constructors of the superclass.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: super can invoke a superclass constructor or access a superclass method or field when permitted.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

super can invoke a superclass constructor or access a superclass method or field when permitted.

7. QuestionMultiple choice

If a variable has a superclass reference type but refers to a subclass object, an overridden method call generally uses

Please select an answer first.

Correct answer: D

The correct answer is the subclass implementation selected at runtime.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: Dynamic method dispatch selects the overridden method based on the actual object at runtime.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

Dynamic method dispatch selects the overridden method based on the actual object at runtime.

8. QuestionMultiple choice

The expression a && b uses short-circuit evaluation when

Please select an answer first.

Correct answer: A

The correct answer is if a is false, b is not evaluated.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: For &&, a false first operand determines the result, so Java can skip evaluating the second operand.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

For &&, a false first operand determines the result, so Java can skip evaluating the second operand.

9. QuestionMultiple choice

A recursive method must include a base case primarily to

Please select an answer first.

Correct answer: B

The correct answer is stop the sequence of recursive calls.

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: The base case provides a condition that returns without another recursive call, preventing unbounded recursion.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

The base case provides a condition that returns without another recursive call, preventing unbounded recursion.

10. QuestionMultiple choice

If an ArrayList contains [4, 7, 9], what is the result of list.remove(1)?

Please select an answer first.

Correct answer: C

The correct answer is The element 7 is removed..

  1. Trace the program or computing system: Identify the data, variables, objects, control flow, abstraction, network layer, or social impact described in the question.
  2. Apply the computer science principle: For an ArrayList, the int argument selects the index, so index 1 removes the value 7.
  3. Check the result and assumptions: Check types, indexes, order of execution, boundary cases, representation, privacy, reliability, and whether the conclusion follows from the evidence.

For an ArrayList, the int argument selects the index, so index 1 removes the value 7.

Numicorn

A Numicorn tip

Share it and study together

Share the page with a friend, solve questions together and keep moving forward.

Test solutions

Review every solution on this page in one place.

Choose your next study path

Frequently asked questions about AP Computer Science Practice

What does this AP Computer Science page cover?

It combines three AP Computer Science A Java practice sets with two current AP Computer Science Principles practice sets covering code, objects, control, collections, data, algorithms, networks, security, computing impact, and responsible computing.

Are AP Computer Science A and AP Computer Science Principles the same exam?

No. They are separate College Board courses and exams. This page is a combined supplemental hub, and each booklet identifies whether it focuses on CSA or CSP.

What is the current AP Computer Science A exam structure?

For the May 2027 administration, the College Board describes a fully digital exam with 42 multiple-choice questions in 90 minutes and 4 Java free-response questions in 90 minutes: methods and control, class design, ArrayList data analysis, and two-dimensional arrays.

What is the current AP Computer Science Principles assessment?

The current AP CSP assessment combines a Create performance task with an end-of-course digital exam. The 2026–27 exam page describes 70 multiple-choice questions in 120 minutes plus two written-response questions connected to the student’s Create project.

Will AP Computer Science Principles change?

College Board has announced a redesign for the 2027–28 school year. This page targets the current 2026–27 framework and May 2027 administration; check official College Board updates for later years.

Are these official College Board questions?

No. They are original supplemental questions. Use College Board resources for the Java Quick Reference, Create task requirements, Bluebook previews, scoring, and administration details.