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 161–170 of 300
  1. 161
  2. 162
  3. 163
  4. 164
  5. 165
  6. 166
  7. 167
  8. 168
  9. 169
  10. 170

Question 161

Multiple choice Arrays
public class TimeRecord { private int hours; private int minutes; // 0<=minutes<60 public TimeRecord(int h, int m) { hours = h; minutes = m; } /** @return the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 162

Multiple choice Arrays
Consider the following instance variable and method findLongest with line numbers added for reference. Method findLongest is intended to find the longest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 163

Multiple choice Arrays
Consider the following instance variable and method findLongest with line numbers added for reference. Method findLongest is intended to find the longest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 164

Multiple choice Arrays
Consider the following instance variable and method. private int[] myStuff; /** Precondition: myStuff 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 165

Multiple choice Arrays
Consider the following instance variable and method. private int[] arr; /** Precondition: arr.length > 0 */ public int checkArray() { int loc = arr.length /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 166

Multiple choice Arrays
Consider the following instance variable and incomplete method, partialSum, which is intended to return an integer array sum such that for all i, sum[i] is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 167

Multiple choice Arrays
A Clock class has hours, minutes, and seconds represented by int values. It also has each of the following methods: setTime to change the time on a Clock to the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 168

Multiple choice Arrays
Consider the following program segment. /** Precondition: a[0]..a[n-1] is an initialized array of integers, * and 0 < n <= a.length. */ int c = 0; for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 169

Multiple choice Arrays
This question refers to the findCheapest method below, which occurs in a class that has an array of AutoPart as one of its private data fields. private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 170

Multiple choice Arrays
Consider an array arr and a list list that is an ArrayList<String>. Both arr and list are initialized with string values. Which of the following code segments…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 161 of 300
Page 17 of 30