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 631–640 of 1,079
  1. 631
  2. 632
  3. 633
  4. 634
  5. 635
  6. 636
  7. 637
  8. 638
  9. 639
  10. 640

Question 631

Multiple choice Arrays
Consider the following code segment. int[] nums = new int[8]; nums[0] = 0; int n = 1; while (n < nums.length) { int k; for (k = n; k < 2 *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 632

Multiple choice Arraylists
What is printed when the following code segment is executed? int[] factors = {2, 3, 5}; ArrayList<Integer> products = new ArrayList<Integer>(); products.add(1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 633

Multiple choice Sorting And Searching
Suppose names is an array of String objects: String[] names = {"Dan", "Ada", "Claire", "Evan", "Boris"}; public class SortX { public static void sort(String[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 634

Multiple choice Sorting And Searching
Consider the following class: public class SortX { public static void sort(String[] items) { int n = items.length; while (n > 1) { sortHelper(items, n - 1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 635

Multiple choice Arraylists
What is printed when the following code segment is executed? ArrayList<Integer> lst = new ArrayList<Integer>(); for (int k = 1; k <= 6;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 636

Multiple choice Arrays
Consider the following method: public int mysteryCount(int[] p) { int count = 0; for (int i = 0; i < p.length; i++) { count++; int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 637

Multiple choice Arrays
Given the following code, which of the answers best describes the conditions needed for temp to be true, when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 638

Multiple choice Arraylists
Consider the following code segment: List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 639

Multiple choice Sorting And Searching
The following incomplete method is intended to sort the array a in ascending order. public void sort() { int maxCompare = a.length - 1; int lIndex = 0; int temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 640

Multiple choice 2D Arrays
Given the following method, what would the result be when m is executed? public void m(int[][] p) { int height = p.length; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 631 of 1,079
Page 64 of 108