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.
All 1,222
Multiple choice 1,079
Free response 143
Subtopic: Arrays
Clear filter
Question 211
Multiple choice
Arrays
Consider the following method: public int countSomething(int[] arr) { int m = arr[0]; int count = 1; for (int k = 1; k < arr.length; k++) { int a =…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 212
Multiple choice
Arrays
Consider the following method: public void change(double[] nums, int n) { for (int k = 0; k < n; k++) { nums[k] = 5.4; } n = 2; } What will be stored…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 213
Multiple choice
Arrays
What is the result when the following code segment is executed? Object[] nums = {null, null, null}; nums[0] = new…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 214
Multiple choice
Arrays
Consider the following code segment, intended to find the position of an integer targetValue in int[] a.…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 215
Multiple choice
Arrays
Consider the following two implementations of the method getValue(double[] c, int n, double x) that computes and returns the value of…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 216
Multiple choice
Arrays
If the classes House and HouseForSale compile with no errors,…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 217
Multiple choice
Arrays
Consider the following code segment: int[] arr = {1, 2, 3, 4, 5, 6, 7, 8}; for (int k = 1; k <= 6; k += 2) { arr[7] = arr[k]; arr[k]…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 218
Multiple choice
Arrays
Consider the following method: public boolean examine(String[] letters) { int count = 0; for (String letter1 : letters) { for (String letter2 : letters) { if…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 219
Multiple choice
Arrays
What is printed when the following code segment is executed? String[] xy = {"X", "Y"};…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 220
Multiple choice
Arrays
Consider the following code segment. int[] nums = new int[8]; nums[0] = 0; int n = 1; while (n < nums.length) { int k; for (k = n; k < 2 *…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 22 of 30
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.