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,901–2,910 of 3,140
  1. 2901
  2. 2902
  3. 2903
  4. 2904
  5. 2905
  6. 2906
  7. 2907
  8. 2908
  9. 2909
  10. 2910

Question 2901

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: dog cat bird public static int totalLength() throws Exception { Scanner file = new Scanner(new File("data.txt"));…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2902

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: 1 2 3 4 5 public static int countNumbers() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2903

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: apple banana cat dog fish bird public static int count() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2904

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: 4 7 2 9 5 8 public static int count() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2905

Multiple choice Unit 4: Data Collections
public static int readNumber() throws Exception { Scanner file = new Scanner(new File("data.txt")); return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2906

Multiple choice Unit 4: Data Collections
public static int readNumber() throws Exception { Scanner file = new Scanner(new File("missing.txt")); return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2907

Multiple choice Unit 4: Data Collections
public static int count() throws Exception { Scanner file = new Scanner(new File("data.txt")); int count = 0; while (file.hasNextInt())…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2908

Multiple choice Unit 4: Data Collections
Consider the following method: public static int recur(int n) { if (n <= 1) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2909

Multiple choice Unit 4: Data Collections
What is printed when the following main method is executed? public class Searcher { private int[] arr = {1, 3, 5, 8, 9}; public int mystery(int low, int high,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2910

Free response Unit 4: Data Collections
This question involves the design of a class that maintains a collection of tasks. The following Task class is provided. public class Task { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,901 of 3,140
Page 291 of 314