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 471–480 of 1,079
  1. 471
  2. 472
  3. 473
  4. 474
  5. 475
  6. 476
  7. 477
  8. 478
  9. 479
  10. 480

Question 471

Multiple choice Arraylists
Consider this program segment. You may assume that wordList has been declared as ArrayList<String>. for (String s :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 472

Multiple choice Recursion
Refer to the following method. public static int mystery(int n) { if (n == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 473

Multiple choice Arraylists
Refer to the following declarations. String[] colors = {"red", "green", "black"}; ArrayList<String> colorList = new ArrayList<String>(); Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 474

Multiple choice Sorting And Searching
Often the most efficient computer algorithms use a divide-and-conquer approach, for example, one in which a list is repeatedly split into two pieces until a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 475

Multiple choice Arraylists
Refer to method removeWord. /** Removes all occurrences of word from wordList. /** Precondition: wordList is an ArrayList of String objects. * Postcondition:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 476

Multiple choice Arrays
A Clock class has hours, minutes, and seconds represented by int values. It also has each of the following methods: setTime to change the time on a Clock to the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 477

Multiple choice 2D Arrays
Consider the following method that will access a square matrix mat. /** Precondition: mat is initialized and is a square matrix. */ public static void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 478

Multiple choice Sorting And Searching
Consider two different ways of storing a set of nonnegative integers in which there are no duplicates. Method One: Store the integers explicitly in an array in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 479

Multiple choice Sorting And Searching
Consider an array arr of 64 distinct int values, which are sorted in increasing order. The first element of the array, arr[0], equals 5, and the last element,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 480

Multiple choice Arrays
Consider the following program segment. /** Precondition: a[0]..a[n-1] is an initialized array of integers, * and 0 < n <= a.length. */ int c = 0; for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 471 of 1,079
Page 48 of 108