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
Given the following definition: int len = 4; int[][] matrix = new int[len][len]; Consider the following code: int total = 0; for (int row = 0;row < len;row++) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following field and method declarations. private List list; public void mystery(int n) { for (int i = 0; i Assume that list has been…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. public static int recur(int n) { if (n <= 1) return…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…
Sign up now. It's free!
See the full question with its answer and worked solution.
Given the following method and what would the result be when m is executed? public void m(int[][] p) { int height = p.length; for…
Sign up now. It's free!
See the full question with its answer and worked solution.
What is the output from mystery(4321) when mystery is defined as follows: Precondition: \(x \geq 0\) public static…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 67
Multiple choice
Arrays
Given the following code which of the answers best describes the conditions needed for temp to be true when it is returned?…
Sign up now. It's free!
See the full question with its answer and worked solution.
Which replacement for /* missing code */ sorts a in ascending order? public static void sort(int[] a) { int maxCompare = a.length - 1 int savedIndex = 0 int…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. What value is returned from a call of mystery(4)?…
Sign up now. It's free!
See the full question with its answer and worked solution.
Which correctly shows the successive outer-loop…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 7 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.