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 311–320 of 1,079
  1. 311
  2. 312
  3. 313
  4. 314
  5. 315
  6. 316
  7. 317
  8. 318
  9. 319
  10. 320

Question 311

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> numbers = new ArrayList<String>(); numbers.add("one"); numbers.add("two"); numbers.add(0, "three");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 312

Multiple choice Arraylists
Consider the following method, which is intended to return a list containing the elements of the parameter myList with all even elements removed. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 313

Multiple choice 2D Arrays
Consider the following code segment. int[][] points = {{11, 12, 13, 14, 15}, {21, 22, 23, 24, 25}, {31, 32, 33, 34, 35}, {41, 42, 43, 44, 45}}; for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 314

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; int sum = 0; for (int[] x :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 315

Multiple choice Arrays
Consider the following code segment. int[] arr = {4, 2, 2, 3, 1}; int num = 0; for (int k = 0;k…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 316

Multiple choice Arraylists
Consider the following method, which is intended to print the ArrayList names in reverse order. public static void printInReverseOrder(ArrayList<String> names)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 317

Multiple choice Recursion
Consider the following method. public static int calc(int n) { if (n == 0) { return 0; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 318

Multiple choice 2D Arrays
Consider the following code segment. int[][] rectangle = new int[4][5]; / * some statements not shown * / x = rectangle[0]; Assume that x has been previously…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 319

Multiple choice Arrays
Consider a method to determine whether two arrays have the same length and same values stored in the same order. public static boolean haveSameContents(int[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 320

Multiple choice Recursion
Consider the following method. public static String doSomething(int current) { if (current <= 0) { return ""; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 311 of 1,079
Page 32 of 108