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 61–70 of 173
  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70

Question 61

Multiple choice Arraylists
Consider the following class used by a company to represent the items it has available for online purchase. public class OnlinePurchaseItem { public double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 62

Multiple choice Arraylists
Consider the following code segment. String crazyString = "crazy"; ArrayList<String> crazyList = new ArrayList<String>(); crazyList.add("weird");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 63

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> nations = new ArrayList<String>(); nations.add("Argentina"); nations.add("Canada");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 64

Multiple choice Arraylists
Consider the following code segment. ArrayList<Integer> newList = new ArrayList<Integer>(); Integer[] list = {2, 4, 3, 3, 2, 5, 1}; newList.add(list[0]); for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 65

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> foods = new ArrayList<String>(); foods.add("Hummus"); foods.add("Soup"); foods.add("Sushi"); foods.set(1,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 66

Multiple choice Arraylists
Consider the following method. /** Precondition: numbers.size() > 0 */ public int totalValue(ArrayList<Integer> numbers) { int total = 0; for (Integer val :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 67

Multiple choice Arraylists
Consider the following code segment. String exampleString = "computer"; ArrayList<String> words = new ArrayList<String>(); for (int k = 0; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 68

Multiple choice Arraylists
Consider the following method. public ArrayList<String> rearrange(ArrayList<String> myList) { for (int i = myList.size() / 2; i >= 0; i--) { String wordA =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 69

Multiple choice Arraylists
Assume obscureAnimals is an ArrayList<String> that has been correctly constructed and populated with the following items. ["okapi", "aye-aye", "cassowary",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 70

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> list = new ArrayList<String>(); list.add("P"); list.add("Q"); list.add("R");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 61 of 173
Page 7 of 18