Study Guide for CS 303E Test 2 (Fall 2009) on 28 Oct 2009 * Loops - while and for * Functions - user defined and built-in * Math Functions * Strings and String Functions * Reading and Writing Text Files * Lists and List Functions * There will be some questions similar to Quiz 2. You will be responsible for all the functions listed in the Study Guide for Quiz 2. * Here are some additional String problems that you want to consider. In all cases you will be asked to write a function. - Write a function that accepts a String as input parameter and returns True if it is palindromic and False otherwise - Write a function that accepts two Strings as input parameters and returns True if they are anagrams and False otherwise - Write a function that accepts a String and a rotation parameter and rotates the String by that amount and returns it. For example, given a String "computer" and a rotation parameter of 2, it will return "ercomput". * Here are some file manipulation problems to look at. - Write a function that accepts two Strings - the name of an input file and a target String. It will return the number of occurences of the target String in the file. - Write a function that accepts the name of an input file and a list of forbidden words. If any one of those forbidden words exists in the file it will return False and True otherwise. * In addition to the list problems given in the Study Guide for Quiz 3, do look at the following problems. - Write a function that accepts a 1-D list as input parameter and returns a 1-D list that is an exact copy of the input list - Write a function that accepts a 2-D list as input parameter and returns a 2-D list that is an exact copy of the input list - Write a function that accepts a 2-D list as input parameter and prints the sum of each row on separate lines - Write a function that accepts a 2-D list as input parameter and prints the sum of each column on separate lines - Write a function that accepts a 2-D list as input parameter and prints the sum of each diagonal. Assume that the 2-D list is square. - Write a function that accepts an input parameter n (that is a positive integer) and returns a 2-D list containing all the numbers from 1 through n (inclusive), their squares, and their cubes. For example if n was 5 your function will return the following 2-D list: [[1, 1, 1], [2, 4, 8], [3, 9, 27], [4, 16, 64], [5, 25, 125]] - Write a function that accepts a 1-D list of integers and returns True if all the numbers are in ascending order and False otherwise. (It will return True if all the elements are the same.)