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.

Subtopic: Recursion Clear filter

Questions 11–20 of 140
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Recursion
What is the output from mystery(4321) when mystery is defined as follows: //precondition: x >=0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Recursion
Consider the following code segment: public static boolean check(String s) { return s.length() >= 2 &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Recursion
Consider the following method. What value is returned from a call of mystery(5)?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Recursion
Given the following code: public static int mystery(String str) { if (str.length() == 0) return 1; else { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

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

Multiple choice Recursion
What is the output from mystery(4321) when mystery is defined as follows: Precondition: \(x \geq 0\) public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Recursion
Consider the following method. What value is returned from a call of mystery(4)?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Recursion
Given the following code: public static int mystery(String str) { if (str.length() == 0) return 0; else { if (str.substring(0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice Recursion
Consider the following instance variable and methods. You may assume that data has been initialized with length > 0. The methods are intended to return the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Recursion
Consider the following recursive method. public int recur(int n) { if (n <= 10) return n * 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 140
Page 2 of 14