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 881–890 of 1,079
  1. 881
  2. 882
  3. 883
  4. 884
  5. 885
  6. 886
  7. 887
  8. 888
  9. 889
  10. 890

Question 881

Multiple choice Recursion
public static int processValue(int n) { if (n == 0) { return 0; } return n +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 882

Multiple choice Recursion
public static int evaluateNumber(int n) { if (n == 0) { return 1; } return 1 +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 883

Multiple choice Recursion
public static int transformNumber(int n) { if (n == 0) { return 0; } if (n % 2 == 0) { return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 884

Multiple choice Recursion
public static int analyzeValue(int n) { if (n == 1) { return 1; } return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 885

Multiple choice Recursion
public static int recursiveProcess(int n) { if (n == 0) { return 0; } return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 886

Multiple choice Using Text Files
Assume the file data.txt contains: 5 7 3 public static int readNumbers() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 887

Multiple choice Using Text Files
Assume the file data.txt contains: apple banana cat public static int countLines() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 888

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

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

Multiple choice Using Text Files
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 881 of 1,079
Page 89 of 108