Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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.

Questions 2,021–2,030 of 2,811
  1. 2021
  2. 2022
  3. 2023
  4. 2024
  5. 2025
  6. 2026
  7. 2027
  8. 2028
  9. 2029
  10. 2030

Question 2021

Multiple choice Unit 4: Data Collections
Starting from [2,4,5,6,8], which replacement safely…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2022

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] points = {{11, 12, 13, 14, 15}, {21, 22, 23, 24, 25}, {31, 32, 33, 34, 35}, {41, 42, 43, 44, 45}}; for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2023

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] arr = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; int sum = 0; for (int[] x :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2024

Multiple choice Unit 4: Data Collections
A value’s span runs from its leftmost occurrence to its rightmost, inclusive. Return the maximum span; empty input gives0. Which replacement for /* missing */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2025

Multiple choice Unit 4: Data Collections
Rearrange so every 3 is immediately followed by 4 without moving3s. Counts match, every 3 has a non3 successor, and the first 3 precedes every 4. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2026

Multiple choice Unit 4: Data Collections
Rearrange so every 4 is immediately followed by 5, without moving4s. Counts match; each 4 has a non4 successor. Fives may originally appear anywhere. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2027

Multiple choice Unit 4: Data Collections
For a nonempty array, test whether it can be split between elements into two nonempty parts of equal sum. Sums fit in int. Which replacement for /* missing */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2028

Multiple choice Unit 4: Data Collections
outer is sorted in nondecreasing order and inner in strictly increasing order. Return true if all inner values occur in outer, using one linear scan. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2029

Multiple choice Unit 4: Data Collections
For n≥0 with n*n fitting in int, create n groups of length n: group1 ends in1, group2 in2,1, and so on; earlier positions are0. Which replacement for /* missing…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2030

Multiple choice Unit 4: Data Collections
For n≥0 and a result length fitting in int, concatenate groups [1],[1,2],...,[1,..., n]. Which replacement for /* missing */ makes the method meet its…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,021 of 2,811
Page 203 of 282