Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 811–820 of 1,079
  1. 811
  2. 812
  3. 813
  4. 814
  5. 815
  6. 816
  7. 817
  8. 818
  9. 819
  10. 820

Question 811

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

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

Multiple choice Arrays
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 814

Multiple choice Arrays
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 815

Multiple choice Arrays
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 816

Multiple choice Arrays
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 817

Multiple choice Recursion
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 818

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

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

Multiple choice Arraylists
What is the output of this code? ArrayList<String> words = new ArrayList<>();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 811 of 1,079
Page 82 of 108