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.

Questions 291–300 of 1,079
  1. 291
  2. 292
  3. 293
  4. 294
  5. 295
  6. 296
  7. 297
  8. 298
  9. 299
  10. 300

Question 291

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; int sum = 0; for (int[] x :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 292

Multiple choice Arrays
A value’s span runs from its leftmost occurrence to its rightmost, inclusive. Return the maximum span; empty input gives0. Which replacement for /* missing */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 293

Multiple choice Arrays
Rearrange so every 3 is immediately followed by 4 without moving3s. Counts match, every 3 has a non3 successor, and the first 3 precedes every 4. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 294

Multiple choice Arrays
Rearrange so every 4 is immediately followed by 5, without moving4s. Counts match; each 4 has a non4 successor. Fives may originally appear anywhere. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 295

Multiple choice Arrays
For a nonempty array, test whether it can be split between elements into two nonempty parts of equal sum. Sums fit in int. Which replacement for /* missing */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 296

Multiple choice Arrays
outer is sorted in nondecreasing order and inner in strictly increasing order. Return true if all inner values occur in outer, using one linear scan. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 297

Multiple choice Arrays
For n≥0 with n*n fitting in int, create n groups of length n: group1 ends in1, group2 in2,1, and so on; earlier positions are0. Which replacement for /* missing…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 298

Multiple choice Arrays
For n≥0 and a result length fitting in int, concatenate groups [1],[1,2],...,[1,..., n]. Which replacement for /* missing */ makes the method meet its…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 299

Multiple choice Arrays
Return the length of the largest contiguous section appearing somewhere in reverse order; overlap is allowed. Which replacement for /* missing */ makes the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 300

Multiple choice Arrays
A clump is a maximal run of at least two equal adjacent values. Return the clump count. Which replacement for /* missing */ makes the method meet its…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 291 of 1,079
Page 30 of 108