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 281–290 of 1,079
  1. 281
  2. 282
  3. 283
  4. 284
  5. 285
  6. 286
  7. 287
  8. 288
  9. 289
  10. 290

Question 281

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 282

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 283

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 284

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 285

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 286

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 287

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 288

Multiple choice Arraylists
What does numbers contain afterward? ArrayList numbers=new ArrayList () numbers.add("one");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 289

Multiple choice Arraylists
Starting from [2,4,5,6,8], which replacement safely…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 290

Multiple choice 2D Arrays
Consider the following code segment. int[][] points = {{11, 12, 13, 14, 15}, {21, 22, 23, 24, 25}, {31, 32, 33, 34, 35}, {41, 42, 43, 44, 45}}; for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 281 of 1,079
Page 29 of 108