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.

Subtopic: Recursion Clear filter

Questions 41–50 of 140
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Recursion
Partition all elements into two groups: one sum divisible by 10 and the other odd. Negative odd sums qualify. Which replacement for /* missing */ makes the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice Recursion
Partition all values into equal-sum groups, with every multiple of 5 forced into group a, and every multiple of 3 that is not a multiple of 5 forced into b.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Recursion
Consider the following method. public static int calc(int n) { if (n == 0) { return 0; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Recursion
Consider the following method. public static String doSomething(int current) { if (current <= 0) { return ""; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Recursion
Consider the following method. public static String processWords(String[] words, int index) { String result; if (index >= words.length) { result = ""; } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Recursion
Which of the following statements about recursion are true? I Every recursive algorithm can be written iteratively. II Tail recursion is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Multiple choice Recursion
Which of the following, when used as the /* body */ of method sum, will enable that method to compute 1 + 2 + ... + n correctly for any \(n \gt 0\)? / * returns…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Multiple choice Recursion
Refer to the method stringRecur. public void stringRecur(String s) { if (s.length() < 15)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Multiple choice Recursion
Refer to method strRecur. public void strRecur(String s) { if (s.length() < 15) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Multiple choice Recursion
public int result(int n) { if (n == 1) return 2; else…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 140
Page 5 of 14