Study Guide for CS 303E Test 2 (Fall 2006) * Write while, do-while, and for loops and be able to convert one loop into another, i.e. say convert a for loop into a while loop. * Write a loop that can sum the terms in a series having all positive numbers or alternate positive and negative numbers. * Write methods with their proper signatures for problems like the following: - a method to determine if a number is prime - a method that reverses a number - a method that determines if a number is palindromic - a method that sums the digits of a number - a method that converts a binary number into decimal or vice versa - a method that returns change using the smallest number of coins * 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) = 2f(n-1), f(1) = 1 f(n) = 4 + 2f(n-1), f(3) = 4 f(n) = 2n + 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. Look at programming exercises 19.3 - 19.6 on p. 652 in your book. * These are methods that you should be able to write using 1-dimensional arrays: - find the max and min elements in the array - search for an element in an unsorted or sorted array - merge two sorted arrays - add two arrays together - determine if two arrays are equal - determine if an array is sorted (either in ascending or descending order) - sort an array * These are methods that you should be able to write using 2-dimensional arrays: - find the max and min elements in the array - search for an element in the array - find the sum of a particular row in the array - find the sum of a particular column in the array - find the sum of any diagonal in the array * Define a simple class having: - a list of attributes - default and non-default constructors - accessors - mutators - any other method that is called for There will be no surprises in the test. It will be strictly based on the topics mentioned in this study guide. The best way to prepare yourself for the test is to write short programs that fulfill the requirements of the bulleted items.