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,171–2,180 of 2,811
  1. 2171
  2. 2172
  3. 2173
  4. 2174
  5. 2175
  6. 2176
  7. 2177
  8. 2178
  9. 2179
  10. 2180

Question 2171

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2172

Multiple choice Unit 4: Data Collections
Consider the following code segment. int [] [] table = new int [5] [6]; int val = 0; for (int k = 0;k < table[0].length;k++) { for (int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2173

Multiple choice Unit 4: Data Collections
Consider the following method. public void selectionSort(String[] arr) { for (int i = 0; i < arr.length; i++) { int small = i; for (int j = i; j < arr.length;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2174

Multiple choice Unit 4: Data Collections
Consider the following code segment. ArrayList<String> foods = new ArrayList<String>(); foods.add("Hummus"); foods.add("Soup"); foods.add("Sushi"); foods.set(1,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2175

Multiple choice Unit 4: Data Collections
Consider the following output. A A A A P P P P C C C C Which of the following code segments will produce this output? I. String[] letters = {"A", "P", "C",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2176

Multiple choice Unit 4: Data Collections
Consider the following recursive method. public int weird(int num) { if (num <= 0) return num; return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2177

Multiple choice Unit 4: Data Collections
Consider the following method. public boolean verifyValues(int[] values) { for (int index = values.length - 1; index > 0; index--) { /* missing code */ return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2178

Multiple choice Unit 4: Data Collections
Consider the following code segment. int [] [] matrix = new int [3] [3]; int value = 0; for (int row = 0;row < matrix.length;row++) { for (int column = 0;column…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2179

Multiple choice Unit 4: Data Collections
Consider the following method. /** Precondition: numbers.size() > 0 */ public int totalValue(ArrayList<Integer> numbers) { int total = 0; for (Integer val :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2180

Multiple choice Unit 4: Data Collections
Assume that planets has been correctly instantiated and initialized to contain the names of the planets. Which of the following code segments will reverse the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,171 of 2,811
Page 218 of 282