Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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 3,021–3,030 of 3,140
  1. 3021
  2. 3022
  3. 3023
  4. 3024
  5. 3025
  6. 3026
  7. 3027
  8. 3028
  9. 3029
  10. 3030

Question 3021

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 3022

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 3023

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 3024

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 3025

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 3026

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 3027

Multiple choice Unit 4: Data Collections
Suppose the file 'words.txt' contains: hello world java code public static String readOddLines(String filename) { Scanner scan = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3028

Multiple choice Unit 4: Data Collections
public static int processAndReturn(ArrayList<Integer> nums) { int total = 0; for (int i = 0;i < nums.size();i++) { int val = nums.get(i);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3029

Multiple choice Unit 4: Data Collections
public static int findSecondMin(int[] data) { int min = Integer.MAX_VALUE; int secondMin = Integer.MAX_VALUE; for (int val : data) { if (val < min) { secondMin…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3030

Free response Unit 4: Data Collections
A LibraryCart stores books that a student plans to check out. public class Book { / * * Returns the title of this book. * / public String getTitle() { / *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3,021 of 3,140
Page 303 of 314