Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice 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.

Subtopic: Sorting And Searching Clear filter

Questions 51–60 of 139
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Multiple choice Sorting And Searching
What safely completes a left-to-right search that returns the matching index…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Multiple choice Sorting And Searching
Which property lets binary search discard a half,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Multiple choice Sorting And Searching
For the best standard algorithms on random-access arrays, which operation has a better worst-case asymptotic time bound on sorted…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Multiple choice Sorting And Searching
A sorted-array search probes every third element from the front, then checks up to two preceding entries in the first…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Multiple choice Sorting And Searching
For a nonempty array,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

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

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

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 59

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 60

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 51 of 139
Page 6 of 14