Verityprep
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.

Subtopic: Arrays Clear filter

Questions 221–230 of 300
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

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.

Question 221 of 300
Page 23 of 30