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,231–2,240 of 3,140
  1. 2231
  2. 2232
  3. 2233
  4. 2234
  5. 2235
  6. 2236
  7. 2237
  8. 2238
  9. 2239
  10. 2240

Question 2231

Multiple choice Unit 4: Data Collections
Consider the following code segment. ArrayList<String> numbers = new ArrayList<String>(); numbers.add("one"); numbers.add("two"); numbers.add(0, "three");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2232

Multiple choice Unit 4: Data Collections
Consider the following method, which is intended to return a list containing the elements of the parameter myList with all even elements removed. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2233

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] points = {{11, 12, 13, 14, 15}, {21, 22, 23, 24, 25}, {31, 32, 33, 34, 35}, {41, 42, 43, 44, 45}}; for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2234

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] arr = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; int sum = 0; for (int[] x :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2235

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[] arr = {4, 2, 2, 3, 1}; int num = 0; for (int k = 0;k…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2236

Multiple choice Unit 4: Data Collections
Consider the following method, which is intended to print the ArrayList names in reverse order. public static void printInReverseOrder(ArrayList<String> names)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2237

Multiple choice Unit 4: Data Collections
Consider the following method. public static int calc(int n) { if (n == 0) { return 0; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2238

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] rectangle = new int[4][5]; / * some statements not shown * / x = rectangle[0]; Assume that x has been previously…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2239

Multiple choice Unit 4: Data Collections
Consider a method to determine whether two arrays have the same length and same values stored in the same order. public static boolean haveSameContents(int[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2240

Multiple choice Unit 4: Data Collections
Consider the following method. public static String doSomething(int current) { if (current <= 0) { return ""; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,231 of 3,140
Page 224 of 314