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 31
Multiple choice
Arrays
What does the following code do when executed? int[] highTemp = {88, 92, 94, 90, 88, 83}; int target = 90;…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 32
Multiple choice
Arrays
The method should detect equal adjacent elements. Which changes are needed? I: initialize…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 33
Multiple choice
Arrays
What will print out when the following code executes? int[] nums = {1, 2, 3, 4, 5, 6}; int…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 34
Multiple choice
Arrays
What does the following code snippet output? int[] numbers = {1, 2, 3, 4, 5}; int[] temp = new int[numbers.length]; for (int i = 0;i < numbers.length - 1;i++) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 35
Multiple choice
Arrays
What does the following code snippet check for? int[] numbers = {1, 2, 3, 3, 4, 5}; boolean mysteryBoolean = false; for (int i = 0;i…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 36
Multiple choice
Arrays
What does the following code snippet do? int[] scores = {80, 92, 91, 68, 88}; int sum = 0; for (int…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 37
Multiple choice
Arrays
What is the output after this code snippet runs? int[] scores = {80, 92, 91, 68, 88};…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 38
Multiple choice
Arrays
Which of the following code snippets gets the THIRD element in the scores array and assigns it to…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 39
Multiple choice
Arrays
Consider the following code segment. int[] nums = new int[51]; for (int k = 0; k < nums.length; k++) nums[k] = 1; for (int k = 3; k <= 50; k += 3)…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 40
Multiple choice
Arrays
Consider the following method with two missing statements. /** Returns the sum of all positive odd values * among the first n elements of arr. * Precondition: 1…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 4 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.