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

Subtopic: Arrays Clear filter

Questions 231–240 of 341
  1. 231
  2. 232
  3. 233
  4. 234
  5. 235
  6. 236
  7. 237
  8. 238
  9. 239
  10. 240

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.

Question 231 of 341
Page 24 of 35