CS231 (Sp03) Review Topics for Final


The final exam is cumulative although the material covered since the last exam will be emphasized. The topics since the last exam are given below. Please also study the material on the review sheets for the first and second exam.
  1. String manipulation. E.g. see your encryption lab
    1. declaring, creating, comparing strings.
    2. Sample exercises: count the number of times the letter 'a' appears in a String; checking to see how many letters vs non-letters a String contains; converting all occurances of a characters c to a character d.
  2. 1D Arrays
    1. declaring, e.g. int nums[];
    2. creating, e.g. nums = new int[10];
    3. loading with primitive types, e.g. for (int i=0;i<nums.length;i++) nums[i]=100;
    4. loading with objects
    5. Sample exercises: loading an integer array with random numbers, summing these numbers and computing an average. Searching an array of strings to find a match.
  3. 2D Arrays
    1. declaring, e.g. int nums[][];
    2. creating, e.g. nums = new int[10][20];
    3. loading with integers
    4. Sample exercises: Create a 10x10 2D array of integers and set all of the array elements to 100.
  4. Using Vectors
    1. declaring and creating, e.g. Vector stuff = new Vector();
    2. loading with objects: stuff.addElement(new Account());
    3. retrieving objects: Account a = (Account) stuff.elementAt(i);
  5. Recursion
    1. What is a recursive method?
    2. Given a recursive method, can you say what it does? E.g. what does the following do?
      public void start() { doStuff(20); }
      
      public void doStuff(int n) {
      	if (n<0) return;
      	else {
      		System.out.println(n);
      		doStuff(n-1);
      	}
      }
  6. Database manipulation: Know how to
    1. Create a simple Account class with name and balance (include accessors, constructors, toString methods).
    2. Create an AccountList Class using an array.
    3. Be able to
      • add items to the list
      • delete items from the list
      • see if the list contains an account with a given name
      • print out the list (i.e. a toString method)
    4. Check for correctness of user input
      • E.g. make sure the user doesn't enter a deposit that is negative or withdraw an amount greater than what they have in their account.
      • Catch error when the user enters a non-numeric value into a TextField that is supposed to take an integer.
        try { 
        	int withdraw = Integer.parseInt(withDrawTextField.getText());
        } catch (Exception e) {
        	outTextArea.append("Error in withdraw amount. Please try again.");
        	return;
        }

[top]

[CS 231 Review Page]