Topics Final CS112 – Spring 2008
Check for updates… this document will most likely be updated a few times!
Last update: 4/20/08 8:30 PM

- Everything from the 1st and 2nd midterms... the final is cumulative and will cover the entire semester!

- Pickling and Shelves
    - What is pickling used for?
    - What happens if you pickle/unpickle in different orders
    - What is pickling called in other languages?
    - Why do we use shelves (what is the advantage over pickling?)
    - How do you use shelves?

- Objects and classes
    In addition to what you did on midterm 2:
    - Know how to sort a list of objects by defining the _cmp_ function
    - Understand how to sort in either ascending or descending directions
    - Know how to write a cmp function
    - Know how to write a _repr_ function and what it does

- Tuples and Sets
    - What is the difference between a tuple and a list?
    - How do I create a tuple?
    - Know that tuples are immutable and WHAT THAT MEANs... what list operations do/do not work with tuples?
    - Know the difference between a sequence type and a set data type
    - How do you create a set in Python?

- Exceptions
    - Know the try/except format and how to write it
    - Know what happens with an 'except:' block
    - Know what happens with multiple except blocks
    - Know how exception propagation works

- How to write a doc string for a function


How to Study
Some help in my opinion for how to study. First: Start EARLY! Many studies show studying a little over a long period of time is much better than studying a lot right before the test!

1. First, make sure you understand fully the previous two midterms. Do this by HIDING the answer from yourself (cut some paper and tape it over your answers), and then re-answer the questions... did you miss any? Try writing the answers in IDLE and seeing what happens.

2. Make sure you understand the items on this study guide - Work through examples on the slides and the projects/labs. Make sure you can write the code... don't just read and it and assume you know it. It's a lot different to read code than it is to write code!

3. Work through the items on the Midterm 2 study guide... do you know everything there? Rework some labs/problems from the book

4. Write out your notecard with things you don't want to memorize

5. Do as many practice problems as you can from the labs/projects/book... work on understanding the concepts and the syntax. Try to fix errors when they occur.

6. Ask questions if you don't understand something. Post questions to Blackboard for things you don't understand. Email me or the TAs also if you need help.


Some sample programming problems to practice
  1. Write a function to find the most common number in a list of numbers passed into the function
  2. Write a function that takes a list of number and returns a count of how many times a number repeats in a row.
            For example:
                    Input: 23224233345542    Output: 4
                    Input: 555                          Output: 2
                    Input 5515                         Output: 1
  3. Write a function that finds the largest and second largest number in a list. Do this WITHOUT using the sort function. Return both values from the function
  4. Write a program that displays the text of a button if you place your mouse over the button (but do not press the button)
  5. Write a function that can capture multiple types of exceptions -- NameError and ZeroDivisionError and then all other exceptions. Take input from the user that could make any of those happen, and print out a specific error message when any error occurs


Write the test yourself!
Here's a deal for you... think of questions that YOU would ask if you were writing the test. Post them to Blackboard under the Exams folder. If I get a lot of questions, I'll pick some and put them on the test.

If you see questions there (that you did not post) give an answer to them... or review an answer if someone else gave it.

Caveat: Realistically, I may not copy the question exactly... for example, if you say "write a function to add 2 numbers", I would more than likly revise it to "write a function to subtract 2 numbers" or something like that... but my question will test the same idea.