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 81–90 of 225
  1. 81
  2. 82
  3. 83
  4. 84
  5. 85
  6. 86
  7. 87
  8. 88
  9. 89
  10. 90

Question 81

Multiple choice Arraylists
Consider the following methods. public List<Integer> process1(int n) { List<Integer> someList = new ArrayList<Integer>(); for (int k = 0; k < n; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 82

Multiple choice Arraylists
What is printed? Assume java.util.ArrayList has been imported. public class Java1102 { public static void main(String[] args) { ArrayList names=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 83

Multiple choice Arraylists
Consider this program segment. You may assume that wordList has been declared as ArrayList<String>. for (String s :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 84

Multiple choice Arraylists
Refer to the following declarations. String[] colors = {"red", "green", "black"}; ArrayList<String> colorList = new ArrayList<String>(); Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice Arraylists
Refer to method removeWord. /** Removes all occurrences of word from wordList. /** Precondition: wordList is an ArrayList of String objects. * Postcondition:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice Arraylists
Consider an ArrayList cards of Card objects that needs to be shuffled. The following algorithm is used for shuffling. Create a temporary ArrayList<Card> Do the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Free response Arraylists
Consider a system for processing names and addresses from a mailing list. A Recipients class will be used as part of this system. The lines in the mailing list…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Multiple choice Arraylists
Let list be an ArrayList<String> containing only these elements. "John", "Mary", "Harry", "Luis" Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 89

Multiple choice Arraylists
Consider the following declaration. ArrayList<Integer> list = new ArrayList<Integer>(); Which of the following code segments will place the integers 1 to 10, in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 90

Multiple choice Arraylists
Refer to the static method removeNegs shown below. /** Precondition: list is an ArrayList<Integer>. * Postcondition: All negative values have been removed from…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 81 of 225
Page 9 of 23