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 51–60 of 173
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Multiple choice Arraylists
For intensive calculations over a fixed-size list of numeric values,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Multiple choice Arraylists
Which statement causes a type error? ArrayList strList=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Multiple choice Arraylists
list is ArrayList with [2,5,7,6,0,1].…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Multiple choice Arraylists
list is nonempty and sorted in decreasing string order. When does insert fail? public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Multiple choice Arraylists
If list initially contains [6,1,8], what does it…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

Multiple choice Arraylists
Assume coins contains nonnull Coin objects. Which replaces /* more code */ in getTotal? public class Coin { private double value private String name public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 57

Multiple choice Arraylists
In Purse.find, coins and aCoin are nonnull. Coins with the same name have the same value, and vice versa. Which replacement detects a match? public class Coin {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 58

Multiple choice Arraylists
Assume list is an ArrayList<Integer> that has been correctly constructed and populated with the following items. [13, 7, 0, 5, 12, 6, 10] Consider the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 59

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> supernatural = new ArrayList<String>(); supernatural.add("Vampire"); supernatural.add("Werewolf");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 60

Multiple choice Arraylists
Consider the following class declaration. public class City { private String name; private int population; public City(String myName, int myPop) { name =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 51 of 173
Page 6 of 18