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 111–120 of 300
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Arrays
An interior val is alone when both neighbors differ from val. Replace each such occurrence with the larger neighbor. Which replacement for /* missing */ makes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Arrays
Return the same multiset of values with all zeros before all nonzeros; nonzero order is unrestricted. Which replacement for /* missing */ makes the method meet…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Arrays
Remove 10s while preserving all other values’ order, filling the unused tail with zeros. 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 114

Multiple choice Arrays
Assume nonnegative values. Replace each zero with the largest odd value to its right, or leave it0 if none exists. Which replacement for /* missing */ makes the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Arrays
Return the same values with evens before odds; order within each group is unrestricted. 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 116

Multiple choice Arrays
For 0≤start≤end, return String values for the range[start, end), using Fizz for multiples of 3, Buzz for 5 and FizzBuzz for both. Which replacement for /*…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Arrays
The segment should count strings containing str as a substring. Which change is needed? String[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Arrays
For a nonempty int array, which segments replace every element with its square? I int k=0; while(k<nums.length) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

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 120

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 111 of 300
Page 12 of 30