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 201–210 of 300
  1. 201
  2. 202
  3. 203
  4. 204
  5. 205
  6. 206
  7. 207
  8. 208
  9. 209
  10. 210

Question 201

Multiple choice Arrays
Return arraySize random even integers in[0,range] inclusive. Assume arraySize≥0 and0≤range≤1000000. Which replacement for /* missing */ makes the method…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 202

Multiple choice Arrays
Consider the following code segment: int[] a = {0, 1}; int[] b = a; a[0] = 1; b[0] = 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 203

Multiple choice Arrays
Consider the following method: /** * Precondition: a != null; a.length > 0 */ private static void doIt(double[] a) { for (int k = 0; k < a.length / 2; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 204

Multiple choice Arrays
Consider the following class: public class ArraySorter { public static void sort(int[] arr) { for (int i = 0; i < arr.length; i++) { for (int j = arr.length -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 205

Multiple choice Arrays
Consider the following three implementations of a method rotate90Degrees and the code segments used to test them. I. public int[] rotate90Degrees(int[] v) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 206

Multiple choice Arrays
String[] a = {"A", "B"}; String[] b = a; String[] c = {a[0], a[1]}; String letter = a[0]; a[0] = a[1]; a[1] =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 207

Multiple choice Arrays
What is the value of v[4] after the following code segment is executed? int d = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 208

Multiple choice Arrays
Consider the following code segment. int[] factors = {2, 3, 4, 7, 2, 5}; int product = 1; for (int i = 1; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 209

Multiple choice Arrays
Consider the following incomplete method cutToAverage. public double cutToAverage(double[] amps) { double avg = 0.0; // missing code return avg; } It first…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 210

Multiple choice Arrays
Consider the following code segment: int[] arr = {4, 3, 2, 1, 0}; for (int k = 1; k < arr.length; k++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 201 of 300
Page 21 of 30