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
Subtopic: Arrays
Clear filter
Question 231
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.
Question 232
Multiple choice
Arrays
Consider the following code segment: public static void test(int[] a, int y) { if (a.length > 1) a[1] = a[1] * 2; y…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 233
Multiple choice
Arrays
Given the following method: public static int test(int[] a, int v) { for (int i = 0; i < a.length;…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 234
Multiple choice
Arrays
Given the following method: boolean temp = false; int count = 0; for (int testval : a) { if (testval == val) count++; } temp…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 235
Multiple choice
Arrays
Consider the following code segment: public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 236
Multiple choice
Arrays
Consider the following method: public static boolean test(int[] a, int val) { boolean temp = false; for (int i = a.length-1; i >= 0; i--)…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 237
Multiple choice
Arrays
Given the following method: public int test(int v) { for (int i = 0; i < a.length; i++) { if…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 238
Multiple choice
Arrays
Consider the following code that is part of a class declaration: private int[] myStuff; // precondition: myStuff contains integers in no particular order public…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 239
Multiple choice
Arrays
Consider the following method: public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y = y *…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 240
Free response
Arrays
Hotel maintains rooms numbered0 through rooms.length−1 and a waiting list of guest names. A null rooms entry is unreserved; any nonnull entry is a Reservation…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 24 of 35
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.