Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice questions unit by unit, 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 2,211–2,220 of 3,140
  1. 2211
  2. 2212
  3. 2213
  4. 2214
  5. 2215
  6. 2216
  7. 2217
  8. 2218
  9. 2219
  10. 2220

Question 2211

Multiple choice Unit 4: Data Collections
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 2212

Multiple choice Unit 4: Data Collections
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 2213

Multiple choice Unit 4: Data Collections
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 2214

Multiple choice Unit 4: Data Collections
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 2215

Multiple choice Unit 4: Data Collections
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 2216

Multiple choice Unit 4: Data Collections
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 2217

Multiple choice Unit 4: Data Collections
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 2218

Multiple choice Unit 4: Data Collections
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 2219

Multiple choice Unit 4: Data Collections
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 2220

Multiple choice Unit 4: Data Collections
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 2,211 of 3,140
Page 222 of 314