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.

1. Test

AP Computer Science Practice Questions

A 10-question AP Computer Science practice set focused on ap computer science a: objects, methods, and control 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

In Java, what is the value of the expression 7 / 2 when both operands are of type int?

Please select an answer first.

Correct answer: A

The correct answer is 3.

  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: Integer division discards the fractional part, so 7 / 2 evaluates to 3.
  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.

Integer division discards the fractional part, so 7 / 2 evaluates to 3.

2. QuestionMultiple choice

Which comparison correctly tests whether two String objects contain the same sequence of characters?

Please select an answer first.

Correct answer: B

The correct answer is s1.equals(s2).

  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 equals method compares String contents. The == operator compares references, and assignment does not perform a content comparison.
  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 equals method compares String contents. The == operator compares references, and assignment does not perform a content comparison.

3. QuestionMultiple choice

What is the result of casting the value 6.9 to type int in Java?

Please select an answer first.

Correct answer: C

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: Casting a positive double to int removes the fractional part rather than rounding to the nearest integer.
  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.

Casting a positive double to int removes the fractional part rather than rounding to the nearest integer.

4. QuestionMultiple choice

Which statement about Math.random() is correct?

Please select an answer first.

Correct answer: D

The correct answer is It returns a double greater than or equal to 0.0 and less than 1.0..

  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: Math.random returns a pseudorandom double in the interval from 0.0 inclusive to 1.0 exclusive.
  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.

Math.random returns a pseudorandom double in the interval from 0.0 inclusive to 1.0 exclusive.

5. QuestionMultiple choice

A method declaration includes a return type, method name, parameter list, and body. The return type specifies

Please select an answer first.

Correct answer: A

The correct answer is the type of value the method must return, unless it is void.

  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 return type describes the value produced by a method; a void method does not return a value.
  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 return type describes the value produced by a method; a void method does not return a value.

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

Which statement about a Java constructor is correct?

Please select an answer first.

Correct answer: B

The correct answer is It has the same name as its class and does not declare a return type..

  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: Constructors initialize objects, use the class name, and do not specify a return type.
  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.

Constructors initialize objects, use the class name, and do not specify a return type.

7. QuestionMultiple choice

If two object variables refer to the same object, changing the object through one variable will

Please select an answer first.

Correct answer: C

The correct answer is be visible through the other 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: Both variables hold references to the same object, so a mutation through either reference affects that shared object.
  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.

Both variables hold references to the same object, so a mutation through either reference affects that shared object.

8. QuestionMultiple choice

Method overloading occurs when a class has methods with

Please select an answer first.

Correct answer: D

The correct answer is the same name but different parameter lists.

  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: Overloaded methods share a name but differ in the number, types, or order of parameters.
  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.

Overloaded methods share a name but differ in the number, types, or order of parameters.

9. QuestionMultiple choice

What is printed by the following code? int x = 4; System.out.println(x++ + " " + x);

Please select an answer first.

Correct answer: A

The correct answer is 4 5.

  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 postfix increment uses the old value in the first expression and then increments x, so the output is 4 5.
  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 postfix increment uses the old value in the first expression and then increments x, so the output is 4 5.

10. QuestionMultiple choice

A method uses return inside an if statement but has no return statement on another possible path. If the method return type is not void, the likely result is

Please select an answer first.

Correct answer: B

The correct answer is a compile-time error because every possible path must return a value.

  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 non-void method must return a compatible value on every possible execution path.
  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 non-void method must return a compatible value on every possible execution path.

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.

Previous testNext test

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.