Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice questions on Data Collections, 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 911–920 of 1,222
  1. 911
  2. 912
  3. 913
  4. 914
  5. 915
  6. 916
  7. 917
  8. 918
  9. 919
  10. 920

Question 911

Multiple choice 2D Arrays
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 912

Multiple choice Using Text Files
// 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 913

Multiple choice Arraylists
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 914

Free response Arraylists
Consider the following incomplete class definition for a grade book: public class StudentGradeBook { private ArrayList<Integer> grades; // values 0-100 public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 915

Free response 2D Arrays
A grayscale image can be represented as a 2D array of integers, where each value is a pixel intensity from 0 (black) to 255 (white). Consider the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 916

Multiple choice Arraylists
An ArrayList<Integer> named list contains [2, 4, 6, 8, 10]. The following loop runs: for (int i = 0; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 917

Multiple choice 2D Arrays
Consider the following code that processes a 2D array: int[][] g = {{1,2,3},{4,5,6},{7,8,9}}; int total = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 918

Multiple choice Arraylists
Consider a method that takes an ArrayList<String> and returns a new ArrayList…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 919

Multiple choice Arrays
What is the output of the following code? int[] arr = {3, 1, 4, 1, 5, 9, 2, 6}; int count = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 920

Multiple choice 2D Arrays
A method receives a 2D integer array and returns true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 911 of 1,222
Page 92 of 123