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.

Questions 441–450 of 1,079
  1. 441
  2. 442
  3. 443
  4. 444
  5. 445
  6. 446
  7. 447
  8. 448
  9. 449
  10. 450

Question 441

Multiple choice Sorting And Searching
Consider the following method. public void selectionSort(String[] arr) { for (int i = 0; i < arr.length; i++) { int small = i; for (int j = i; j < arr.length;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 442

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 443

Multiple choice 2D Arrays
Consider the following output. A A A A P P P P C C C C Which of the following code segments will produce this output? I. String[] letters = {"A", "P", "C",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 444

Multiple choice Recursion
Consider the following recursive method. public int weird(int num) { if (num <= 0) return num; return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 445

Multiple choice Arrays
Consider the following method. public boolean verifyValues(int[] values) { for (int index = values.length - 1; index > 0; index--) { /* missing code */ return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 446

Multiple choice 2D Arrays
Consider the following code segment. int [] [] matrix = new int [3] [3]; int value = 0; for (int row = 0;row < matrix.length;row++) { for (int column = 0;column…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 447

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 448

Multiple choice Arrays
Assume that planets has been correctly instantiated and initialized to contain the names of the planets. Which of the following code segments will reverse the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 449

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 450

Multiple choice Recursion
Consider the following recursive method. public void wackyOutput (String wacky) { if (wacky.length() < 1) return; wacky =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 441 of 1,079
Page 45 of 108