Question
Some multiple choice questions on recursion 2. An algorithm design technique involving breaking a problem into smaller versions of the original is called a) top-down
Some multiple choice questions on recursion
2. An algorithm design technique involving breaking a problem into smaller versions of the original is called
a) top-down design
b) test-driven development
c) divide and conquer
d) search and destroy
3. Which of the following is a correct coding of the recursive expression for reversing a string?
a) reverse(s[1:]) + s[0]
b) s[0] + reverse(s[1:])
c) s[-1] + reverse(s[:-1])
d) both a and c
9. An infinite recursion will result in
a) a program that hangs.
b) a broken computer
c) a reboot
d) a run-time exception
10. The recursive Fibonacci function is inefficient because
a) recursion is inherently inefficient compared to iteration
b) calculating Fibonacci numbers is an intractable problem
c) it performs many repeated calculations
d) all of the above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started