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 571–580 of 1,079
  1. 571
  2. 572
  3. 573
  4. 574
  5. 575
  6. 576
  7. 577
  8. 578
  9. 579
  10. 580

Question 571

Multiple choice Arraylists
Consider the following code segment: ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 1; i <= 8; i++) { list.add(i); } for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 572

Multiple choice Arraylists
Consider the following code segment with a missing for loop: ArrayList<String> letters = new ArrayList<String>(); letters.add("A"); letters.add("B");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 573

Multiple choice Arraylists
Consider the following code segment: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Integer> numbers = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 574

Multiple choice Arraylists
Consider the following code segment: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<String> list = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 575

Multiple choice Sorting And Searching
Consider the following scenario: A school is organizing a race, and the top three fastest runners will receive awards. The race times of 500…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 576

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private double[][] data; public Matrix(int rows, int cols) { // < missing statements > } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 577

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private int[][] data; public Matrix(int rows, int cols) { data = new int[rows][cols]; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 578

Multiple choice Arrays
Consider the following class: public class ArraySorter { public static void sort(int[] arr) { for (int i = 0; i < arr.length; i++) { for (int j = arr.length -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 579

Multiple choice Sorting And Searching
Merge sort takes about18ms for80000 random values and40ms for160000. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 580

Multiple choice Sorting And Searching
The Binary Search algorithm is designed to work with an array sorted in ascending order. Under which of the following circumstances will the algorithm find a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 571 of 1,079
Page 58 of 108