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
Get step-by-step solutions from verified subject matter experts
