Recursion in Java (AP Computer Science A)

Recursion in Java (AP Computer Science A)

Assessment

Assessment

Created by

Patrick Ferrer

Computers

9th - 12th Grade

98 plays

Medium

Student preview

quiz-placeholder

10 questions

Show all answers

1.

MULTIPLE CHOICE

30 sec • 1 pt

When the base case is met, which of these could be returned?

[Enclosing method: recursiveFunc(int n)]

2.

MULTIPLE CHOICE

20 sec • 1 pt

The capabilities of a recursive function can typically be recreated by . . .

3.

MULTIPLE CHOICE

45 sec • 1 pt

For which of these operations is a recursive function practical?

4.

MULTIPLE CHOICE

30 sec • 1 pt

What is a recursive function?

5.

MULTIPLE CHOICE

30 sec • 1 pt

Which of these is NOT an acceptable header for a recursive function?

6.

MULTIPLE CHOICE

45 sec • 1 pt

Media Image

Assuming n is initialized as an integer variable with a positive value, what will be printed?

7.

MULTIPLE SELECT

2 mins • 1 pt

Media Image

The Collatz Conjecture states that, in sequence, taking any integer and, if even, halving the result/integer and, if odd, tripling and adding 1 to the result/integer continuously will eventually end up as 1.


Which of the above methods properly recreates the conjecture?

Select all answers that apply.


(Click the picture to enlarge.)

8.

MULTIPLE SELECT

2 mins • 1 pt

Media Image

Which of the above methods correctly implements indirect recursion?

Select all answers that apply.

9.

MULTIPLE SELECT

2 mins • 1 pt

Media Image

Which of the above methods correctly implements direct recursion?

Select all answers that apply.

10.

MULTIPLE SELECT

1 min • 1 pt

Media Image

Which of the above methods could result in a stack overflow exception for certain values of n?

Select all answers that apply.

Explore all questions with a free account

or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?