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 2,831–2,840 of 3,140
  1. 2831
  2. 2832
  3. 2833
  4. 2834
  5. 2835
  6. 2836
  7. 2837
  8. 2838
  9. 2839
  10. 2840

Question 2831

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 2832

Free response Unit 4: Data Collections
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 2833

Free response Unit 4: Data Collections
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 2834

Multiple choice Unit 4: Data Collections
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 2835

Multiple choice Unit 4: Data Collections
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 2836

Multiple choice Unit 4: Data Collections
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 2837

Multiple choice Unit 4: Data Collections
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 2838

Multiple choice Unit 4: Data Collections
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 2839

Multiple choice Unit 4: Data Collections
What is the output of the following? ArrayList<Integer> a = new ArrayList<>(); for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2840

Multiple choice Unit 4: Data Collections
A file numbers.txt contains one integer per line. Which code segment correctly reads all integers and finds the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,831 of 3,140
Page 284 of 314