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 11–20 of 300
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Arrays
Consider the following incomplete method that is intended to return a string formed by concatenating elements from the parameter words. The elements to be…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Arrays
Assume that an array of integer values has been declared as follows and has been initialized. int[] arr =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Arrays
Consider the following instance variable and incomplete method. The method calcTotal is intended to return the sum of all values in vals. private int[] vals;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Arrays
Consider the following incomplete method. Method findNext is intended to return the index of the first occurrence of the value val beyond the position start in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Arrays
Given the following code which of the answers best describes the conditions needed for temp to be true when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Arrays
Given the following code which of the answers best describes the conditions needed for temp to be true when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Arrays
Consider the following method. public static int mystery(int[] arr) { int x = 0; for (int k = 0; k < arr.length; k = k + 2) x = x + arr[k]; return x; } Assume…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Arrays
Consider the following method that is intended to return the sum of the elements in the array key. public static int sumArray(int[] key) { int sum = 0; for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Arrays
Consider the following method, isSorted, which is intended to return true if an array of integers is sorted in nondecreasing order and to return false…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 300
Page 2 of 30