Study Guide for CS 303E Test 2 (Fall 2008) For this test you are responsible for all of the material we have covered in class so far. Use the lecture notes and a subset of the material from Chapters 1 through 4, 6 through 8, and Recursion. * Use if-else, if-elif-else in a computation * Write while and for loops and be able to convert one type of loop into another, i.e. say convert a for loop into a while loop * Use strings and string functions * Write formated output * Read, write, and append to text files * Use the functions in the math module to perform computations * Write functions with their proper signatures for problems like the following: - a function to determine if a number is prime - a function to determine if a number is perfect (number = sum of its divisors) - a function that reverses a number - a function that sums the digits of a number - a function that determines if a number is palindromic - a function that prints a string in reverse - a function that determines if two strings are anagrams - a function that given the amount to be returned as change prints out the minimum number of coins (quarters, dimes, nickels, and pennies) needed to do so * Use user defined functions to write another function. For example, functions X() and Y() are defined for you, use them in function Z() to solve a given problem. * Given a recurrence relation write a recursive and / or iterative method that returns the nth term in that relation. Here are some examples of recurrence relations: f(n) = 3 + f(n - 1), f(1) = 0 f(n) = 2 * f(n - 1), f(1) = 1 f(n) = 4 + 2 * f(n - 1), f(3) = 4 f(n) = 2 * n + 1 + f(n -1), f(2) = 2 * Given a recursive method, you will be asked to determine the output for a given set of input parameters. * Illustrate how merge sort works on a given list of numbers by showing the placement of the numbers after each merge operation.