Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions on Data Collections, 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 391–400 of 1,079
  1. 391
  2. 392
  3. 393
  4. 394
  5. 395
  6. 396
  7. 397
  8. 398
  9. 399
  10. 400

Question 391

Multiple choice Sorting And Searching
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 392

Multiple choice Sorting And Searching
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 393

Multiple choice Sorting And Searching
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 394

Multiple choice Sorting And Searching
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 395

Multiple choice Sorting And Searching
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 396

Multiple choice Sorting And Searching
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 397

Multiple choice Sorting And Searching
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 398

Multiple choice Sorting And Searching
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 399

Multiple choice Sorting And Searching
Which input requires the fewest executions of a[j+1]=a[j] while sorting descending? private Integer[] a; public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 400

Multiple choice Sorting And Searching
Which input requires the most executions of a[j+1]=a[j] while sorting descending? private Integer[] a; public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 391 of 1,079
Page 40 of 108