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 651–660 of 1,079
  1. 651
  2. 652
  3. 653
  4. 654
  5. 655
  6. 656
  7. 657
  8. 658
  9. 659
  10. 660

Question 651

Multiple choice Sorting And Searching
Which of the following is (are) true? I. Insertion sort takes longer when the array is sorted in ascending order and you want it sorted in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 652

Multiple choice 2D Arrays
Given the following values for a 2D array m and the following code: 1 1 1 1 1 2 3 4 2 2 2 2 2 4 6 8 int sum = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 653

Multiple choice 2D Arrays
int len = 4; int[][] matrix = new int[len][len]; int total = 0; for (int row = 0; row < len; row++) { total = total + matrix[row][1]; } Assume…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 654

Multiple choice Arraylists
Consider the following Java class field and method: private List<Integer> list; public void mystery(int n) { for (int i = 0; i < n; i++) { Object obj =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 655

Multiple choice Recursion
Consider the following method: public static int recur(int n) { if (n <= 1) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 656

Multiple choice Arraylists
Consider the execution of the following Java code, which manipulates an ArrayList of strings: List<String> list = new ArrayList<String>(); list.add("a");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 657

Multiple choice 2D Arrays
Given the following method public void m(int[][] p) { int height = p.length; for (int row = 0;row < height / 2;row++) { for (int col =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 658

Multiple choice Recursion
Given the following recursive method: // precondition: x >= 0 public static void mystery(int x) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 659

Multiple choice Arrays
Given the following method: boolean temp = false; int count = 0; for (int testval : a) { if (testval == val) count++; } temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 660

Multiple choice Sorting And Searching
Given the following partial implementation of a sorting algorithm: public static void sort(int[] a) { int maxCompare = a.length - 1; int savedIndex = 0; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 651 of 1,079
Page 66 of 108