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,581–2,590 of 3,140
  1. 2581
  2. 2582
  3. 2583
  4. 2584
  5. 2585
  6. 2586
  7. 2587
  8. 2588
  9. 2589
  10. 2590

Question 2581

Multiple choice Unit 4: Data Collections
public class APTestResult { private String subject; private int score; public int getScore() { return score; } // constructor and other methods not shown }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2582

Multiple choice Unit 4: Data Collections
What is printed when the following code segment is executed? String[] xy = {"X", "Y"};…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2583

Multiple choice Unit 4: Data Collections
Suppose m is a two-dimensional array of size 4 by 4, with all its elements initialized to zeros. The method fill is defined as follows: public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2584

Multiple choice Unit 4: Data Collections
Consider the following method: /* * Returns the number of zeros in s. * Precondition: s.length() = 31; s consists of several * '0's followed by several '1's *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2585

Multiple choice Unit 4: Data Collections
Consider the following method: public String encrypt(String word) { int pos = word.length() / 2; if (pos >= 1) { word =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2586

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

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

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

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

Multiple choice Unit 4: Data Collections
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 2,581 of 3,140
Page 259 of 314