Study Guide for CS 312 Test 2 (Summer 2012) * Write loops with while, do-while, for, and for-each. Convert one type of loop to another. Write loops to create patterns. Give the output of a loop. * Write methods with their proper signatures (headers) for problems that have input parameters with Strings and arrays as well as return Strings and arrays. * Use methods that someone has already written, in a method of your own. * Given a recursive method you should be able to tell me what the output will be for a given set of its input parameter(s) and write an iterative version for the method by looking at its output. * Write recursive method for given specification. * These are methods that you should be able to write using 1-dimensional arrays: - find the max and min elements in the array - find the second highest element in an array - add two arrays together - multiply corresponding elements in two arrays and return the sum - determine if two arrays are equal - determine if an array is sorted (either in ascending or descending order) - reverse the elements of an array in place * 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 - find the sum of two 2-dimensional arrays * These are the methods that you must be familiar with in the Math class: - abs() - sqrt() - pow() - ceil() - floor() - random() * These are the methods in the String class that you should be familiar with: - length() - equals() - equalsIgnoreCase() - compareTo() - charAt() - indexOf() - substring() - split() * These are the methods in the StringBuffer class that you should be familiar with: - append() - insert() - delete() - replace() - reverse() - toString() * You should also be able to open a text file for reading and open a text file for writing. 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. Practice using the problems giving in LiveLab and Coding Bat.