Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Java Foundations
Quiz 11: Recursion
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Short Answer
Write a recursive definition for K(n), which represents the product of all of the even integers less than or equal to n.
Question 22
Essay
Describe a recursive solution to the Towers of Hanoi puzzle with N disks.
Question 23
Essay
Describe a recursive solution to determine whether a String object is a palindrome. You may assume that the string only contains lower case characters (i.e. no numbers, spaces, punctuation, etc). Hint: It may be easiest to describe your solution using pseudocode.
Question 24
Essay
Describe the Towers of Hanoi puzzle.
Question 25
True/False
The Towers of Hanoi puzzle cannot be solved iteratively.
Question 26
True/False
A program with infinite recursion will act similarly to a program with an infinite loop.
Question 27
Essay
What is recursion?
Question 28
Short Answer
Write a recursive method that computes the sum of the first n integers.
Question 29
Essay
Write a recursive method that computes the product of all of the even integers less than or equal to n.
Question 30
True/False
Recursion is necessary.
Question 31
Short Answer
What is wrong with the following recursive method that computes the sum of all of the odd positive integers less than or equal to n? public int sumOfOdds(int n) { if(n%2 == 0) return sumOfOdds(n-1); else return n + sumOfOdds(n-2); }
Question 32
Essay
Write a recursive Java method that takes in a String as a parameter and returns true if the String is a palindrome. You may assume that the string only contains lower case characters (i.e. no numbers, spaces, punctuation, etc).
Question 33
Short Answer
The Fibonacci sequence is defined as the sum of the two previous elements of the sequence, with the first and second numbers in the sequence being 0 and 1 respectively. Write a recursive method that computes the nth Fibonacci number.