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 601–610 of 1,079
  1. 601
  2. 602
  3. 603
  4. 604
  5. 605
  6. 606
  7. 607
  8. 608
  9. 609
  10. 610

Question 601

Multiple choice Arrays
Consider the following method: public int countSomething(int[] arr) { int m = arr[0]; int count = 1; for (int k = 1; k < arr.length; k++) { int a =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 602

Multiple choice Arrays
Consider the following method: public void change(double[] nums, int n) { for (int k = 0; k < n; k++) { nums[k] = 5.4; } n = 2; } What will be stored…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 603

Multiple choice 2D Arrays
Consider the following code segment: for (int r = 1;r < mat.length;r++) { for (int c = 1;c < mat[0].length;c++) { if ((r + c) % 2 == 0) mat[r][c] = 2 * mat[r -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 604

Multiple choice Arraylists
What happens when the size of an ArrayList<Integer>…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 605

Multiple choice Sorting And Searching
Suppose an array arr contains 127 different random values arranged in ascending order, and the most efficient searching…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 606

Multiple choice Arraylists
Suppose ArrayList<Integer> numbers and ArrayList<String> names are created as follows: ArrayList<Integer> numbers = new ArrayList<Integer>(); Integer x = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 607

Multiple choice Arrays
What is the result when the following code segment is executed? Object[] nums = {null, null, null}; nums[0] = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 608

Multiple choice Recursion
Consider the following method: private int product(int n) { if (n <= 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 609

Multiple choice Recursion
Consider the following method: private int product(int n) { if (n <= 1) return 1; else return n * product(n - 2); }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 610

Multiple choice Arraylists
Consider the following method: /** * Rearranges the elements in words according to the values stored in an integer array indices, * so that the element of words…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 601 of 1,079
Page 61 of 108