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: Arrays Clear filter

Questions 171–180 of 300
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Multiple choice Arrays
Consider the following mergeSort method and the private instance variable a both in the same Sorter class. private int[] a; /** Sorts a[first] to a[last] in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Multiple choice Arrays
Consider the following instance variable and method. private int[] nums; /** Precondition: nums contains int values in no particular order. */ public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

Multiple choice Arrays
A class of 30 students rated their computer science teacher on a scale of 1 to 10 (1 means awful and 10 means outstanding). The responses array is a 30-element…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 174

Multiple choice Arrays
Consider an array arr that is initialized with int values. The following code segment stores in count the number of positive values in arr. int count = 0, index…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Multiple choice Arrays
Assume that a Book class has a compareTo method in which, if b1 and b2 are Book objects, b1.compareTo(b2) is a negative integer if b1 is less than b2, a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 176

Multiple choice Arrays
Refer to the following data field and method. private int[] arr; /** Precondition: arr.length > 0 and index < arr.length. */ public void remove(int index) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Multiple choice Arrays
Consider an array arr that is sorted in increasing order, and method findMost given below. Method findMost is intended to find the value in the array that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Arrays
Consider an array arr that is sorted in increasing order, and method findMost given below. Method findMost is intended to find the value in the array that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Multiple choice Arrays
public class Card { private String suit; private int value; //0 to 12 public Card(String cardSuit, int cardValue) {/* implementation */ } public String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

Multiple choice Arrays
Refer to the following method that finds the smallest value in an array. /** Precondition: arr is an array of nonzero length * and is initialized with int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 171 of 300
Page 18 of 30