Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice 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 171–180 of 225
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

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 172

Free response Arraylists
GPSRouter stores routes in an initialized ArrayList routes. Route provides String getName(), int getMiles(), and void setMiles(int num). The provided…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

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 174

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 175

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 176

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 177

Free response Arraylists
Consider the following incomplete class definition for a grade book: public class StudentGradeBook { private ArrayList<Integer> grades; // values 0-100 public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Arraylists
An ArrayList<Integer> named list contains [2, 4, 6, 8, 10]. The following loop runs: for (int i = 0; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Multiple choice Arraylists
Consider a method that takes an ArrayList<String> and returns a new ArrayList…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

Multiple choice Arraylists
What is the output of the following? ArrayList<Integer> a = new ArrayList<>(); for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 171 of 225
Page 18 of 23