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,551–2,560 of 2,811
  1. 2551
  2. 2552
  3. 2553
  4. 2554
  5. 2555
  6. 2556
  7. 2557
  8. 2558
  9. 2559
  10. 2560

Question 2551

Multiple choice Unit 4: Data Collections
Assume that info.txt contains the following: Hello World AP CSA Good Bye Consider the following code segment: File file = new File("info.txt"); Scanner scanner…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2552

Multiple choice Unit 4: Data Collections
What is the output of this code? ArrayList<String> words = new ArrayList<>();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2553

Multiple choice Unit 4: Data Collections
What is the value of sum after the following executes? int[][] grid = { {1, 2, 3}, {4, 5,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2554

Multiple choice Unit 4: Data Collections
Consider traversing an ArrayList while removing elements. Which approach avoids skipping elements? // Approach I – forward traversal for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2555

Multiple choice Unit 4: Data Collections
Consider the following method: public static int[] doubleArray(int[] arr) { int[] result = new int[arr.length]; for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2556

Multiple choice Unit 4: Data Collections
What is the output of the following code? int[] arr = {5, 3, 8, 1, 9}; int result = arr[0]; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2557

Multiple choice Unit 4: Data Collections
Consider the following: ArrayList<Integer> list = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2558

Multiple choice Unit 4: Data Collections
What does the following method return for input [[1,2],[3,4],[5,6]]? public static int colSum(int[][] m, int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2559

Multiple choice Unit 4: Data Collections
// Assume: File f = new File("data.txt"); // File contains space-separated integers…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2560

Multiple choice Unit 4: Data Collections
An ArrayList<Integer> named scores contains [85, 92, 78, 96,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,551 of 2,811
Page 256 of 282