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,331–2,340 of 2,811
  1. 2331
  2. 2332
  3. 2333
  4. 2334
  5. 2335
  6. 2336
  7. 2337
  8. 2338
  9. 2339
  10. 2340

Question 2331

Multiple choice Unit 4: Data Collections
Consider the following method: public String filter(String str, String pattern) { int pos = str.indexOf(pattern); if (pos == -1) return str; else return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2332

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2333

Multiple choice Unit 4: Data Collections
Consider the following method: public int countSomething(int[] arr) { int m = arr[0]; int count = 1; for (int k = 1; k < arr.length; k++) { int a =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2334

Multiple choice Unit 4: Data Collections
Consider the following method: public void change(double[] nums, int n) { for (int k = 0; k < n; k++) { nums[k] = 5.4; } n = 2; } What will be stored…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2335

Multiple choice Unit 4: Data Collections
Consider the following code segment: for (int r = 1;r < mat.length;r++) { for (int c = 1;c < mat[0].length;c++) { if ((r + c) % 2 == 0) mat[r][c] = 2 * mat[r -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2336

Multiple choice Unit 4: Data Collections
What happens when the size of an ArrayList<Integer>…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2337

Multiple choice Unit 4: Data Collections
Suppose an array arr contains 127 different random values arranged in ascending order, and the most efficient searching…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2338

Multiple choice Unit 4: Data Collections
Suppose ArrayList<Integer> numbers and ArrayList<String> names are created as follows: ArrayList<Integer> numbers = new ArrayList<Integer>(); Integer x = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2339

Multiple choice Unit 4: Data Collections
What is the result when the following code segment is executed? Object[] nums = {null, null, null}; nums[0] = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2340

Multiple choice Unit 4: Data Collections
Consider the following method: private int product(int n) { if (n <= 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,331 of 2,811
Page 234 of 282