Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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,521–2,530 of 3,140
  1. 2521
  2. 2522
  3. 2523
  4. 2524
  5. 2525
  6. 2526
  7. 2527
  8. 2528
  9. 2529
  10. 2530

Question 2521

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

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 2523

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 2524

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 2525

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 2526

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 2527

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 2528

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 2529

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 2530

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 2,521 of 3,140
Page 253 of 314