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 81–90 of 1,079
  1. 81
  2. 82
  3. 83
  4. 84
  5. 85
  6. 86
  7. 87
  8. 88
  9. 89
  10. 90

Question 81

Multiple choice Arrays
Consider the following code segment. int[] arr = {1, 2, 3, 4, 5, 6, 7}; for (int k = 3; k < arr.length - 1; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 82

Multiple choice Arrays
Consider the following method. public static void arrayMethod(int nums[]) { int j = 0; int k = nums.length - 1; while (j < k) { int x =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 83

Multiple choice 2D Arrays
Consider the following method, which is intended to return the element of a 2-dimensional array that is closest in value to a specified number, val. /** @return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 84

Multiple choice Arraylists
Consider the following instance variable and method. private List<String> animals; public void manipulate() { for (int k = animals.size() - 1; k > 0; k--) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice 2D Arrays
Consider the following code segment. int[] oldArray = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int[][] newArray = new int[3][3]; int row = 0; int col = 0; for (int value :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice Arrays
Assume that the array arr has been defined and initialized as follows. int[] arr = /* initial values for the array */ ; Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Multiple choice Arrays
Consider the following method. public void mystery(int[] data) { for (int k = 0; k < data.length - 1; k++) data[k + 1] = data[k] + data[k + 1]; } The following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Multiple choice Recursion
Consider the following recursive method. public int recur(int n) { if (n <= 10) return n * 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 89

Multiple choice Recursion
Consider the following recursive method. public static void whatsItDo(String str) { int len = str.length(); if (len > 1) { String temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 90

Multiple choice Arrays
What is the output of the following program? public class SayHello { public void run() { String stringArray[] =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 81 of 1,079
Page 9 of 108