Question Bank · Unit 4
AP® Computer Science A Data Collections Multiple Choice Questions
Work through AP Computer Science A multiple-choice 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 221
Multiple choice
Arrays
Consider the following method: public int mysteryCount(int[] p) { int count = 0; for (int i = 0; i < p.length; i++) { count++; int j…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 222
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 223
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 224
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 225
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 226
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 227
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 228
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 229
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 230
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.
Page 23 of 30
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.