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 131–140 of 173
  1. 131
  2. 132
  3. 133
  4. 134
  5. 135
  6. 136
  7. 137
  8. 138
  9. 139
  10. 140

Question 131

Multiple choice Arraylists
What are the final list contents?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 132

Multiple choice Arraylists
What is printed? java.util.ArrayList a=new java.util.ArrayList…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 133

Multiple choice Arraylists
Consider the following method. public void reviseList(ArrayList<Integer> list) { for (int i = 0; i < list.size(); i++) { int temp = list.get(i); if (temp % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 134

Multiple choice Arraylists
Consider the following code segment. What is printed when this code is executed? ArrayList<String> list = new ArrayList<>(); list.add("apple");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 135

Multiple choice Arraylists
Assume that an ArrayList names holds the following values. {"Debbie", "Rob", "Kelly", "Sandy", "Kim", "J.P. ", "Andy", "Tim",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 136

Multiple choice Arraylists
Suppose that glop is an ArrayList of DooHickeys. The Doohickeys class contains two accessor methods getMass() and getId() that returns the mass and ID number…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 137

Multiple choice Arraylists
What is the output of this code? ArrayList<String> words = new ArrayList<>();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 138

Multiple choice Arraylists
Consider traversing an ArrayList while removing elements. Which approach avoids skipping elements? // Approach I – forward traversal for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 139

Multiple choice Arraylists
Consider the following: ArrayList<Integer> list = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 140

Multiple choice Arraylists
An ArrayList<Integer> named scores contains [85, 92, 78, 96,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 131 of 173
Page 14 of 18