Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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 2,301–2,310 of 2,811
  1. 2301
  2. 2302
  3. 2303
  4. 2304
  5. 2305
  6. 2306
  7. 2307
  8. 2308
  9. 2309
  10. 2310

Question 2301

Multiple choice Unit 4: Data Collections
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 2302

Multiple choice Unit 4: Data Collections
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 2303

Multiple choice Unit 4: Data Collections
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 2304

Multiple choice Unit 4: Data Collections
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 2305

Multiple choice Unit 4: Data Collections
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 2306

Multiple choice Unit 4: Data Collections
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 2307

Multiple choice Unit 4: Data Collections
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 2308

Multiple choice Unit 4: Data Collections
Consider the following class definition: public class Matrix { private double[][] data; public Matrix(int rows, int cols) { // < missing statements > } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2309

Multiple choice Unit 4: Data Collections
Consider the following class definition: public class Matrix { private int[][] data; public Matrix(int rows, int cols) { data = new int[rows][cols]; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2310

Multiple choice Unit 4: Data Collections
Consider the following class: public class ArraySorter { public static void sort(int[] arr) { for (int i = 0; i < arr.length; i++) { for (int j = arr.length -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,301 of 2,811
Page 231 of 282