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

Question 601

Multiple choice Recursion
Which algorithm is implemented? Assume array is sorted ascending. public static int mystery(int[] array,int a) { int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 602

Multiple choice Recursion
public void printSomething(String s) { int n = s.length(); if(n >= 1) { String s1 = s.substring(1,n); printSomething(s1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 603

Multiple choice Arrays
Consider the following code segment: int[] a = {0, 1}; int[] b = a; a[0] = 1; b[0] = 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 604

Multiple choice Recursion
Consider the following method: public void mystery(int a, int b) { System.out.print(a +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 605

Multiple choice Arrays
Consider the following method: /** * Precondition: a != null; a.length > 0 */ private static void doIt(double[] a) { for (int k = 0; k < a.length / 2; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 606

Multiple choice Arraylists
Consider the following code segment: ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 1; i <= 8; i++) { list.add(i); } for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 607

Multiple choice Arraylists
Consider the following code segment with a missing for loop: ArrayList<String> letters = new ArrayList<String>(); letters.add("A"); letters.add("B");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 608

Multiple choice Arraylists
Consider the following code segment: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Integer> numbers = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 609

Multiple choice Arraylists
Consider the following code segment: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<String> list = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 610

Multiple choice Sorting And Searching
Consider the following scenario: A school is organizing a race, and the top three fastest runners will receive awards. The race times of 500…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 601 of 1,222
Page 61 of 123