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,811–2,820 of 3,140
  1. 2811
  2. 2812
  3. 2813
  4. 2814
  5. 2815
  6. 2816
  7. 2817
  8. 2818
  9. 2819
  10. 2820

Question 2811

Multiple choice Unit 4: Data Collections
Consider the following method. public static void readFile(String filename) { File file = new File(filename); Scanner sc = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2812

Multiple choice Unit 4: Data Collections
Assume that an ArrayList names holds the following values. {"Debbie", "Rob", "Kelly", "Sandy", "Kim", "J.P. ", "Andy", "Tim",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2813

Multiple choice Unit 4: Data Collections
Suppose that glop is an ArrayList of DooHickeys. The Doohickeys class contains two accessor methods getMass() and getId() that returns the mass and ID number…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2814

Multiple choice Unit 4: Data Collections
private int n; public boolean check(int[ ] arr) { boolean theCheck = true; for (int k = 0; k < n - 1; k++) { if (arr[k] >= arr[k+1]) theCheck =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2815

Multiple choice Unit 4: Data Collections
private int n; public boolean check(int[ ] arr) { boolean theCheck = true; for (int k = 0; k < n - 1; k++) { if (arr[k] >= arr[k+1]) theCheck =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2816

Multiple choice Unit 4: Data Collections
Consider the following incomplete method that is intended to determine if the corresponding elements of two parallel arrays are equal. // precondition:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2817

Multiple choice Unit 4: Data Collections
Consider the following code segment: String[] data = {"3.5", "2.1", "4.4", "1.2"}; double sum = 0.0; for (int i = 0; i < data.length; i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2818

Multiple choice Unit 4: Data Collections
Consider the following recursive method. public static int mystery(int x) { if (x <= 1 || x == 3)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2819

Multiple choice Unit 4: Data Collections
Consider the following code segment: public void readLines() { File myFile = new File("data.txt"); Scanner scanner = new Scanner(myFile); while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2820

Multiple choice Unit 4: Data Collections
Assume that info.txt contains the following: Hello World AP CSA Good Bye Consider the following code segment: File file = new File("info.txt"); Scanner scanner…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,811 of 3,140
Page 282 of 314