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,151–2,160 of 2,811
  1. 2151
  2. 2152
  3. 2153
  4. 2154
  5. 2155
  6. 2156
  7. 2157
  8. 2158
  9. 2159
  10. 2160

Question 2151

Multiple choice Unit 4: Data Collections
Consider the following method. public int loopy(int n) { if (n % 7 == 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2152

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2153

Multiple choice Unit 4: Data Collections
Consider the following code segment. int [] ray = new int [11]; for (int i = 0; i < ray.length; i++) { ray[i] = i * 2; } for (int m = 0; m < 5;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2154

Multiple choice Unit 4: Data Collections
Consider the following method. public void mystery (int[] array) { for (int i = 1; i < array.length; i++) { int j; int key = array[i]; for (j = i - 1; j >= 0 &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2155

Multiple choice Unit 4: Data Collections
Consider the following class declaration. public class City { private String name; private int population; public City(String myName, int myPop) { name =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2156

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[] myArray = {2, 3, 4, 1, 7, 6, 8}; int index = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2157

Multiple choice Unit 4: Data Collections
Consider the following class used by a company to represent the items it has available for online purchase. public class OnlinePurchaseItem { public double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2158

Multiple choice Unit 4: Data Collections
Consider the following method. public int mystery(int n) { if (n <= 1) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2159

Multiple choice Unit 4: Data Collections
Consider the following method. public int guess(int num1, int num2) { if (num1 % num2 == 0) return (num2 + num1) / 2; return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2160

Multiple choice Unit 4: Data Collections
Consider the following code segment. String crazyString = "crazy"; ArrayList<String> crazyList = new ArrayList<String>(); crazyList.add("weird");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,151 of 2,811
Page 216 of 282