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.

3. Test

AP Computer Science Practice Questions

A 10-question AP Computer Science practice set focused on ap computer science a: arraylist, 2d arrays, and algorithms 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

For an ArrayList list, which expression returns the number of elements currently stored?

Please select an answer first.

Correct answer: C

The correct answer is list.size().

  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 size() method returns the current number of elements in an ArrayList.
  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 size() method returns the current number of elements in an ArrayList.

2. QuestionMultiple choice

If int[][] grid = new int[3][4], which statement is true?

Please select an answer first.

Correct answer: D

The correct answer is The array has 3 rows and 4 columns..

  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 first dimension specifies the number of rows and the second specifies the number of columns.
  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 first dimension specifies the number of rows and the second specifies the number of columns.

3. QuestionMultiple choice

Which traversal visits every element of a rectangular two-dimensional array?

Please select an answer first.

Correct answer: A

The correct answer is A nested loop over rows and columns.

  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 nested loop visits each valid row-column pair and therefore every element in the rectangular array.
  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 nested loop visits each valid row-column pair and therefore every element in the rectangular array.

4. QuestionMultiple choice

A linear search for a target in an unsorted list is complete when

Please select an answer first.

Correct answer: B

The correct answer is the target is found or every element has been checked.

  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: Linear search must continue until it finds the target or exhausts the available elements.
  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.

Linear search must continue until it finds the target or exhausts the available elements.

5. QuestionMultiple choice

Binary search requires the collection to be sorted because it

Please select an answer first.

Correct answer: C

The correct answer is uses the middle element to eliminate half of the remaining possibilities.

  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: Binary search determines which half can contain the target based on an ordered 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.

Binary search determines which half can contain the target based on an ordered comparison.

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

If an ArrayList variable is assigned to another variable without copying the elements, changing one list may change the other because

Please select an answer first.

Correct answer: D

The correct answer is both variables can refer to the same ArrayList object.

  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: Object assignment copies the reference, not the elements, so both variables can alias the same list.
  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.

Object assignment copies the reference, not the elements, so both variables can alias the same list.

7. QuestionMultiple choice

For the String "computer", what does substring(1, 4) return?

Please select an answer first.

Correct answer: A

The correct answer is "omp".

  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 starting index is included and the ending index is excluded, so indexes 1, 2, and 3 produce "omp".
  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 starting index is included and the ending index is excluded, so indexes 1, 2, and 3 produce "omp".

8. QuestionMultiple choice

A method removes every negative value from an ArrayList while iterating from left to right. After removing an element at index i, the method should generally

Please select an answer first.

Correct answer: B

The correct answer is avoid incrementing the index immediately because the next element shifts into index i.

  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: After removal, later elements shift left, so examining the same index prevents skipping the element that moved into it.
  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.

After removal, later elements shift left, so examining the same index prevents skipping the element that moved into it.

9. QuestionMultiple choice

A method returns the largest value in a nonempty integer array. The method should initialize the current maximum using

Please select an answer first.

Correct answer: C

The correct answer is an element from the array, such as the first element.

  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: Initializing from an actual element works for arrays containing both positive and negative values.
  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.

Initializing from an actual element works for arrays containing both positive and negative values.

10. QuestionMultiple choice

A code segment that analyzes an ArrayList and returns a result based on a stated specification primarily demonstrates the practice of

Please select an answer first.

Correct answer: D

The correct answer is developing and analyzing code to implement an algorithm.

  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: Implementing and testing a method over a collection applies code development, data manipulation, and algorithm analysis.
  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.

Implementing and testing a method over a collection applies code development, data manipulation, and algorithm analysis.

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.