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,731–2,740 of 2,811
  1. 2731
  2. 2732
  3. 2733
  4. 2734
  5. 2735
  6. 2736
  7. 2737
  8. 2738
  9. 2739
  10. 2740

Question 2731

Multiple choice Unit 4: Data Collections
Consider the following code: public static void doubleAll(int[] numbers) { for (int val : numbers) { val = val * 2; } }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2732

Multiple choice Unit 4: Data Collections
public static ArrayList<Integer> buildList(int[] arr) { ArrayList<Integer> result = new ArrayList<Integer>(); for (int val : arr) { if (val % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2733

Multiple choice Unit 4: Data Collections
public static void removeNegatives(ArrayList<Integer> list) { for (int i = 0;i < list.size();i++) { if (list.get(i) < 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2734

Multiple choice Unit 4: Data Collections
The Player class is defined as follows: public class Player { private String name; private int score; public Player(String name, int score) { this.name = name;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2735

Multiple choice Unit 4: Data Collections
public static void insertBeforeOld(ArrayList<String> words) { for (int i = 0;i < words.size();i++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2736

Multiple choice Unit 4: Data Collections
Consider the following code: public static int findMaxRowSum(int[][] grid) { int maxSum = 0; for (int row = 0; row < grid.length; row++) { int rowSum = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2737

Multiple choice Unit 4: Data Collections
Consider the following code: public static String buildOrder(int[][] grid) { String result = ""; for (int col = 0;col < grid[0].length;col++) { for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2738

Multiple choice Unit 4: Data Collections
Consider the following code: public static void flipHorizontal(int[][] grid) { for (int row = 0;row < grid.length;row++) { for (int col = 0;col <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2739

Multiple choice Unit 4: Data Collections
Consider the following code: public static int countNeighbors(int[][] grid, int row, int col) { int count = 0; for (int r = row - 1; r <= row + 1; r++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2740

Multiple choice Unit 4: Data Collections
Suppose the file "numbers.txt" contains: 8 -3 12 -1 4 public static int averagePositive(String filename) { Scanner scan = new Scanner(new File(filename)); int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,731 of 2,811
Page 274 of 282