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 661–670 of 1,079
  1. 661
  2. 662
  3. 663
  4. 664
  5. 665
  6. 666
  7. 667
  8. 668
  9. 669
  10. 670

Question 661

Multiple choice 2D Arrays
Given the following 2D array declaration and initialization: int[][] matrix = {{-1, -2, 3}, {4, -5, 6}}; And the method: public static void changeMatrix(int[][]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 662

Multiple choice Recursion
Consider the following recursive method: public static int mystery(int n) { if (n == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 663

Multiple choice Sorting And Searching
Given the initial array: {6, 3, 8, 5, 1} Which of the following correctly shows…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 664

Multiple choice Recursion
Given the following recursive method: public static int mystery(String str) { if (str.length() == 0) return 0; else { if (str.substring(0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 665

Multiple choice Sorting And Searching
Which scenario will cause the longest execution time for a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 666

Multiple choice Arrays
Consider the following code segment: public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 667

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 668

Multiple choice Recursion
Consider the following code segment: private int[] arr; public int mystery(int low, int high, int num) { int mid = (low + high) / 2; if (low > high) { return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 669

Multiple choice Arraylists
Consider the following code segment: ArrayList<String> list1 = new ArrayList<String>(); list1.add("a"); list1.add("b"); list1.add(0, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 670

Multiple choice Recursion
Consider the following recursive method: public static int mystery(String str) { if (str.length() == 1) return 0; else { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 661 of 1,079
Page 67 of 108