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 891–900 of 1,222
  1. 891
  2. 892
  3. 893
  4. 894
  5. 895
  6. 896
  7. 897
  8. 898
  9. 899
  10. 900

Question 891

Multiple choice Using Text Files
Does this method compile? Assume the imports are present. public void readFile(String filename){ java.util.Scanner scan=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 892

Multiple choice Using Text Files
data.txt contains one line: Hello-World-AP-CSA. The file opens successfully and checked exceptions are handled by the enclosing method. What is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 893

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

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 895

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 896

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 897

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 898

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 899

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 900

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 891 of 1,222
Page 90 of 123