Question Bank · Unit 4
AP® Computer Science A Data Collections Practice Questions
Work through AP Computer Science A practice questions on Data Collections, then check each answer against a worked solution.
Free · no sign-up
Open questions need no account. Sign up or log in to open the rest.
All 1,222
Multiple choice 1,079
Free response 143
Suppose ArrayList<Integer> numbers and ArrayList<String> names are created as follows: ArrayList<Integer> numbers = new ArrayList<Integer>(); Integer x = 1;…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 642
Multiple choice
Arrays
What is the result when the following code segment is executed? Object[] nums = {null, null, null}; nums[0] = new…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method: private int product(int n) { if (n <= 1)…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method: private int product(int n) { if (n <= 1) return 1; else return n * product(n - 2); }…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method: /** * Rearranges the elements in words according to the values stored in an integer array indices, * so that the element of words…
Sign up now. It's free!
See the full question with its answer and worked solution.
Given two arrays of double values sorted in ascending order, one with 100 elements and the other with 10 elements, how many…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 647
Multiple choice
Arrays
Consider the following code segment, intended to find the position of an integer targetValue in int[] a.…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method, intended to use Binary Search to find the location of target within ArrayList<String> a. public int…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 649
Multiple choice
Arrays
Consider the following two implementations of the method getValue(double[] c, int n, double x) that computes and returns the value of…
Sign up now. It's free!
See the full question with its answer and worked solution.
What is printed as a result of executing the following code segment? ArrayList<String> digits = new ArrayList<String>(); for (int k = 0; k <= 9; k++)…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 65 of 123
Get your FRQs graded in the Student Portal
In the Verityprep Student Portal, answer the FRQs of AP practice and past exams by typing or uploading a photo. A teacher grades them with that year's official College Board scoring guidelines and gives you an estimated 1–5 score.
Join Verityprep now
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.