AP CS A Unit 7 Review

call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:58 AM on 5/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Add student to class section state
Add studentsNo students in these sections. Invite them to track progress!

12 Terms

1
New cards

What is recursion?

Recursion occurs when a method calls itself.

2
New cards

What are the two types of cases in a recursive method?

Base case and non-base case.

3
New cards

What is the purpose of a base case in recursion?

To terminate the recursion.

4
New cards

In the method 'go()', what does 'isClear(AHEAD)' represent?

It is the base case for the recursion.

5
New cards

What does the simple recursive algorithm for adding count look like?

If the thing you're counting still exists, return (adding amount) + recursive call(thing-1); otherwise, return base case.

6
New cards

What does the 'bunnyEars' method do?

It returns the total number of bunny ears based on the number of bunnies.

7
New cards

What is the return value of 'bunnyEars(3)'?

6 (because there are 3 bunnies, each with 2 ears).

8
New cards

What is the structure of a recursive method for matrix recursion?

Check if in bounds and some other condition, mark cell as visited, then make recursive calls for neighboring cells.

9
New cards

What does the 'play' method do?

It performs actions based on the conditions of the matrix and makes recursive calls.

10
New cards

What is the output of the method 'a(3,4)'?

15.

11
New cards

How does the method 'a(int n, int m)' work?

If n == 1, return m; otherwise, return m + a(n-1, m+1).

12
New cards

What is the result of '4 + a(2,5)' in the tracing of recursion?

11.