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.

Questions 711–720 of 1,222
  1. 711
  2. 712
  3. 713
  4. 714
  5. 715
  6. 716
  7. 717
  8. 718
  9. 719
  10. 720

Question 711

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 712

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 713

Multiple choice Sorting And Searching
Consider the following array: {7, 3, 8, 5, 2} Which of the following correctly…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 714

Multiple choice 2D Arrays
Given the following 2D array m: Row 0: 1 1 1 1 Row 1: 1 2 3 4 Row 2: 2 2 2 2 Row 3: 2 4 6 8 Consider the following code segment: int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 715

Multiple choice Arrays
Consider the following method: public static boolean test(int[] a, int val) { boolean temp = false; for (int i = a.length-1; i >= 0; i--)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 716

Multiple choice Recursion
Consider the following method: public static int m1(int a) { if (a == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 717

Multiple choice Recursion
Consider the following Java class: public class Searcher { private int[] arr = {1, 3, 5, 8, 9}; public int mystery(int low, int high, int num) { int mid = (low…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 718

Multiple choice Sorting And Searching
The following incomplete method is intended to sort the array elem in ascending order using the selection sort algorithm. public static void sort(int[] elem) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 719

Multiple choice 2D Arrays
Consider the following code segment: int[][] mat = new int[3][4]; for (int row = 0;row < mat.length;row++) { for (int col = 0;col < mat[0].length;col++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 720

Multiple choice Arrays
Given the following method: public int test(int v) { for (int i = 0; i < a.length; i++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 711 of 1,222
Page 72 of 123