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,121–2,130 of 2,811
  1. 2121
  2. 2122
  3. 2123
  4. 2124
  5. 2125
  6. 2126
  7. 2127
  8. 2128
  9. 2129
  10. 2130

Question 2121

Multiple choice Unit 4: Data Collections
Assuming a is nonempty, when does this code definitely fail its intended…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2122

Multiple choice Unit 4: Data Collections
For [89,42,−3,13,109,70,2], what is the array after the third outer-loop pass of descending selection sort? public class Sorter { private Integer[] a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2123

Multiple choice Unit 4: Data Collections
With the bounds-safe repair shown, which ordering precondition makes search correct…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2124

Multiple choice Unit 4: Data Collections
For key27, what inclusive interval remains after the first loop iteration? private int[] a; // Precondition: a is sorted in ascending order. public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2125

Multiple choice Unit 4: Data Collections
How many loop iterations determine that27 is absent? private int[] a; // Precondition: a is sorted in ascending order. public int binSearch(int key) { int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2126

Multiple choice Unit 4: Data Collections
What is y after int y=binSearch(4)? private int[] a; // Precondition: a is sorted in ascending order. public int binSearch(int key) { int low=0,high=a.length-1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2127

Multiple choice Unit 4: Data Collections
If the condition changes to low<high, which listed existing value is missed? private int[] a; // Precondition: a is sorted in ascending order. public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2128

Multiple choice Unit 4: Data Collections
After each unsuccessful iteration of binSearch, which is a safe loop invariant? private int[] a; // Precondition: a is sorted in ascending order. public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2129

Multiple choice Unit 4: Data Collections
A successful binary search on about30000 sorted elements must be…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2130

Multiple choice Unit 4: Data Collections
For [1,7,9,5,4,12], what is the result after the third outer-loop pass? private Integer[] a; public void insertionSort() {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,121 of 2,811
Page 213 of 282