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 641–650 of 1,222
  1. 641
  2. 642
  3. 643
  4. 644
  5. 645
  6. 646
  7. 647
  8. 648
  9. 649
  10. 650

Question 641

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 642

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 643

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 644

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 645

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 646

Multiple choice Sorting And Searching
Given two arrays of double values sorted in ascending order, one with 100 elements and the other with 10 elements, how many…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 647

Multiple choice Arrays
Consider the following code segment, intended to find the position of an integer targetValue in int[] a.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 648

Multiple choice Sorting And Searching
Consider the following method, intended to use Binary Search to find the location of target within ArrayList<String> a. public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 649

Multiple choice Arrays
Consider the following two implementations of the method getValue(double[] c, int n, double x) that computes and returns the value of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 650

Multiple choice Arraylists
What is printed as a result of executing the following code segment? ArrayList<String> digits = new ArrayList<String>(); for (int k = 0; k <= 9; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 641 of 1,222
Page 65 of 123