Study Guide for CS 312 Test 2 (Summer 2014) * Test 2 will cover material in chapters 1 through 8. * Number Conversions (you may use a calculator) Decimal to binary, octal, hexadecimal and vice versa Representation of negative numbers in 2's complement binary * ASCII and Unicode representations of characters * Write Boolean expressions * Evaluate expressions * Use increment and decrement operators * Know the difference between applying (&& and &) and (|| and |) * Use the bitwise operators (& | ^ ~) in a computation * Use the shift operators (<<, >>, >>>) in a computation * Use the conditional operator ? : * Read integers and floating point numbers from the console with Scanner * Use if-else or nested if-else in a computation * Use of switch statements - change switch to nested if-else and vice versa * Write loops with while, do-while, and for. 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 as well as return Strings. * Use methods that someone has already written, in a method of your own. * Use the algorithms discussed in class on Selection Sort, Sequential Search, Binary Search and Merging * 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 - search for an element in an unsorted or sorted array - merge two sorted arrays - 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) - sort an array - return an array that has the cummulative sum of another array - reverse the elements of an array in place - remove duplicate elements in 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 - find the sum of two 2-dimensional arrays - reverse either the rows or the columns in a 2-D array - transpose a 2-D array - perform a matrix multiplication * 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. * The questions will be of two types - you will either write short pieces of code as methods or you will interpret code and compute the output of the code. 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 given in LiveLab and Coding Bat at the level of Logic-2, Array-3 and String-3.