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 1,801–1,810 of 2,811
  1. 1801
  2. 1802
  3. 1803
  4. 1804
  5. 1805
  6. 1806
  7. 1807
  8. 1808
  9. 1809
  10. 1810

Question 1801

Multiple choice Unit 4: Data Collections
Consider the following method. What value is returned from a call of mystery(4)?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1802

Multiple choice Unit 4: Data Collections
Which correctly shows the successive outer-loop…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1803

Multiple choice Unit 4: Data Collections
Given the following code: public static int mystery(String str) { if (str.length() == 0) return 0; else { if (str.substring(0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1804

Multiple choice Unit 4: Data Collections
A recursive binary search on a sorted 10-element array uses mid=(low+high)/2 and returns −1 only…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1805

Multiple choice Unit 4: Data Collections
How many calls to mystery occur, including the initial call, for mystery(0,4,5) with arr={1,2,3,5,7}? private int[] arr; public int mystery(int low, int high,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1806

Multiple choice Unit 4: Data Collections
Consider the following method. public static int mystery(int[] arr) { int x = 0; for (int k = 0; k < arr.length; k = k + 2) x = x + arr[k]; return x; } Assume…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1807

Multiple choice Unit 4: Data Collections
Consider the following method. public ArrayList<Integer> mystery(int n) { ArrayList<Integer> seq = new ArrayList<Integer>(); for (int k = 1; k <= n; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1808

Multiple choice Unit 4: Data Collections
Consider the following method that is intended to return the sum of the elements in the array key. public static int sumArray(int[] key) { int sum = 0; for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1809

Multiple choice Unit 4: Data Collections
Consider the following instance variable and methods. You may assume that data has been initialized with length > 0. The methods are intended to return the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1810

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1,801 of 2,811
Page 181 of 282