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.

Subtopic: Sorting And Searching Clear filter

Questions 111–120 of 139
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Sorting And Searching
Consider the following method: /* * Returns the number of zeros in s. * Precondition: s.length() = 31; s consists of several * '0's followed by several '1's *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Sorting And Searching
Suppose names is an array of String objects: String[] names = {"Dan", "Ada", "Claire", "Evan", "Boris"}; public class SortX { public static void sort(String[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Sorting And Searching
Consider the following class: public class SortX { public static void sort(String[] items) { int n = items.length; while (n > 1) { sortHelper(items, n - 1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Sorting And Searching
The following incomplete method is intended to sort the array a in ascending order. public void sort() { int maxCompare = a.length - 1; int lIndex = 0; int temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Sorting And Searching
Which of the following correctly shows the iterations of an ascending (from…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Multiple choice Sorting And Searching
Which of the following correctly shows the iterations of an ascending (from…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Sorting And Searching
Which of the following is (are) true? I. Insertion sort takes longer when the array is sorted in ascending order and you want it sorted in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Sorting And Searching
Given the following partial implementation of a sorting algorithm: public static void sort(int[] a) { int maxCompare = a.length - 1; int savedIndex = 0; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Sorting And Searching
Given the initial array: {6, 3, 8, 5, 1} Which of the following correctly shows…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Sorting And Searching
Which scenario will cause the longest execution time for a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 139
Page 12 of 14