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 131–139 of 139
  1. 131
  2. 132
  3. 133
  4. 134
  5. 135
  6. 136
  7. 137
  8. 138
  9. 139

Question 131

Multiple choice Sorting And Searching
Consider using selection sort (which repeatedly finds the minimum of the unsorted portion and swaps it with the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 132

Multiple choice Sorting And Searching
Consider using insertion sort (processing index i from 1 upward, inserting arr[i] into the sorted prefix arr[0..i-1]) on the array {8, 2, 6, 1, 4}. What is the array after the first three iterations (i = 1, 2, 3) of the outer loop?
Pick an answer, then check it. The solution opens in a window.

Question 133

Multiple choice Sorting And Searching
Consider an int array a initially equal to {40, 18, 25, 7, 31, 12}. Selection sort, sorting in ascending order, repeatedly finds the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 134

Multiple choice Sorting and Searching
Suppose arr is declared and initialized as follows. int[] arr = {7, 3, 9, 2, 5}; After one pass of selection sort that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 135

Multiple choice Sorting and Searching
Suppose arr is declared and initialized as follows. int[] arr = {8, 4, 6, 3, 7}; After the first three passes of insertion sort…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 136

Multiple choice Sorting and Searching
Suppose a standard binary search is used to locate 12 in the following sorted array.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 137

Multiple choice Sorting And Searching
Selection sort is used on the array {6, 2, 8, 1,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 138

Multiple choice Sorting And Searching
Insertion sort is used on the array {9, 4, 7, 3, 8}. What is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 139

Multiple choice Sorting And Searching
A binary search is performed on the sorted array {2, 5, 9, 14, 20, 27, 31, 40} for target 27. The midpoint is computed…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 131 of 139
Page 14 of 14