1. |
The factorial of a positive integer is the product of all nonnegative integers less than or equal to that number. (The symbol for factorial is "!" - the exclamation mark.) Answer: |

2. |
Two rectangular mirrors of identical size are directly opposite each other on the opposite walls of a room. Due to the separation between the mirrors, the image of each mirror shrinks to two-thirds its size in the opposing mirror. This produces a series of rectangles of ever decreasing size in each mirror. Write a recursive program that produces this series of rectangles until a rectangle becomes so small as to become inconsequential. Answer: |

3. |
Write a recursive program to compute the sum of the numbers from 1 to n, where n is a positive number greater than or equal to 1. Answer: |

4. |
A formula for finding the greatest common divisor (GCD) of two numbers was formulated by the mathematician Euclid around 300 BCE. The GCD of two numbers is the largest number that will divide into both numbers without any remainder. For example, the GCD of 12 and 16 is 4, the GCD of 18 and 12 is 6. Answer: |

5. |
Many fractals can be programmed using recursive methods. Those fractals using initiator/generator methods lend themselves to some elegant solutions using recursion. A modified version of the von Koch snowflake curve is described below. Answer: |

6. |
Popular state lotteries consist of many sequentially numbered small balls. A subset of the small balls is chosen. If someone correctly predicts the numbers on the balls that were chosen, that person wins the lottery. The odds of winning a lottery can be computed by a Answer: |

7. |
Write a program to draw the logarithmic spiral recursively. Answer: |

8. |
Most calculators except input in the form of infix notation, that is Answer: |

9. |
A common programming error is an infinite recursion. Define infinite recursion and give an example of code that may cause infinite recursion. Answer: |

10. |
Recursive programs usually take more time and use more memory than iterative programs. If this is the case, why would you ever write a program using recursion? Answer: |

11. |
The golden mean, often referred to as the golden ratio, divine proportion, or the golden number is represented by the Greek letter phi ( Φ ). The value of the golden mean is (1 + sqrt(5)) / 2 or 1.61803 . . . The golden mean is found in nature and art and tends to yield the most "aesthetically pleasing" arrangements of objects. Answer: |