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: Arraylists Clear filter

Questions 111–120 of 173
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Arraylists
Consider the following incomplete method, which shuffles a list of Card objects so that any card can end up at any index in the list deck, with equal…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Arraylists
The method addStars is intended to append "*" at the end of each string in the ArrayList<String> words. Which of the following implementations of addStars will…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Arraylists
public class APTestResult { private String subject; private int score; public int getScore() { return score; } // constructor and other methods not shown }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Arraylists
What is printed when the following code segment is executed? int[] factors = {2, 3, 5}; ArrayList<Integer> products = new ArrayList<Integer>(); products.add(1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Arraylists
What is printed when the following code segment is executed? ArrayList<Integer> lst = new ArrayList<Integer>(); for (int k = 1; k <= 6;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Multiple choice Arraylists
Consider the following code segment: List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Arraylists
Consider the following Java class field and method: private List<Integer> list; public void mystery(int n) { for (int i = 0; i < n; i++) { Object obj =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Arraylists
Consider the execution of the following Java code, which manipulates an ArrayList of strings: List<String> list = new ArrayList<String>(); list.add("a");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Arraylists
Consider the following code segment: ArrayList<String> list1 = new ArrayList<String>(); list1.add("a"); list1.add("b"); list1.add(0, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Arraylists
Consider the following declaration of the class RandomList, which has a constructor intended to initialize the instance variable numList to an ArrayList of n…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 173
Page 12 of 18