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,531–2,540 of 2,811
  1. 2531
  2. 2532
  3. 2533
  4. 2534
  5. 2535
  6. 2536
  7. 2537
  8. 2538
  9. 2539
  10. 2540

Question 2531

Multiple choice Unit 4: Data Collections
Consider the following method, which is intended to return the maximum integer value contained in ranges. /** Precondition: ranges contains at least one…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2532

Multiple choice Unit 4: Data Collections
A text file named roster.txt has the following contents. Assume that the file contains no spaces. Cohen-Isabel Lee-Cindy Patel-Anisha Sanchez-Michael In the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2533

Multiple choice Unit 4: Data Collections
Consider the following method. public void reviseList(ArrayList<Integer> list) { for (int i = 0; i < list.size(); i++) { int temp = list.get(i); if (temp % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2534

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] arr2D = /* missing initialization */; int sum = 0; for (int j = 0; j < arr2D.length; j++) { sum +=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2535

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] arr = {{10, -7, 19, 14}, {-3, -2, -6, 11}, {-9, 12, 10, -1}}; int ans = 1; for (int[] row : arr) { for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2536

Multiple choice Unit 4: Data Collections
The following method is a correct implementation of the selection sort algorithm. The method sorts the elements of arr so that they are in order from least to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2537

Multiple choice Unit 4: Data Collections
Consider the following method. public static void mystery(int j, int k) { if (j > k) { mystery(j -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2538

Multiple choice Unit 4: Data Collections
Consider the following code segment. What is printed when this code is executed? ArrayList<String> list = new ArrayList<>(); list.add("apple");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2539

Multiple choice Unit 4: Data Collections
info.txt contains exactly 2.5 Hello World. The file exists, opens successfully, and the enclosing method handles checked file-opening exceptions. What happens?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2540

Multiple choice Unit 4: Data Collections
Does this method compile? Assume the imports are present. public void readFile(String filename){ java.util.Scanner scan=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,531 of 2,811
Page 254 of 282