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 151–160 of 300
  1. 151
  2. 152
  3. 153
  4. 154
  5. 155
  6. 156
  7. 157
  8. 158
  9. 159
  10. 160

Question 151

Multiple choice Arrays
players has been allocated as a BingoCard array but its entries are null. Which constructs and stores each card? public class BingoCard { private int[] card…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 152

Multiple choice Arrays
Consider the following code segment. int [] array = {-3, 0, 2, 4, 5, 9, 13, 1, 5}; for (int n = 1; n < array.length - 1; n++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 153

Multiple choice Arrays
Consider the following code segment. int [] ray = new int [11]; for (int i = 0; i < ray.length; i++) { ray[i] = i * 2; } for (int m = 0; m < 5;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 154

Multiple choice Arrays
Consider the following code segment. int[] myArray = {2, 3, 4, 1, 7, 6, 8}; int index = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 155

Multiple choice Arrays
Assume int[] arr has been correctly instantiated and is of sufficient size. Which of these code segments results in identical arrays? I. int i = 1; while (i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 156

Multiple choice Arrays
Consider the following method. public int doStuff(int[] numberArray) { int index = 0; int maxCounter = 1; int counter = 1; for (int k = 1; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 157

Multiple choice Arrays
Consider the following method. public int changeEm(int num1, int num2, int[] values) { num1 = values[num2]; values[num1] = num2; num2++; return num2; } Consider…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 158

Multiple choice Arrays
The following code segment appears in the main method of another class. AnotherClass[] acArray = new AnotherClass[10]; acArray[2] = new AnotherClass("two");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 159

Multiple choice Arrays
Consider the following method. public boolean verifyValues(int[] values) { for (int index = values.length - 1; index > 0; index--) { /* missing code */ return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 160

Multiple choice Arrays
Assume that planets has been correctly instantiated and initialized to contain the names of the planets. Which of the following code segments will reverse the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 151 of 300
Page 16 of 30