CSci 157 Midterm Review


Exam Coverage:

Fundamental concepts as presented in lecture and the text: 

Numbers, Expressions, Statements

Know how to recognize valid and invalid names for variables and other objects in Python. Be able to evaluate expressions by hand using operator precedence and common functions from modules such as math. You're allowed to use the operator precedence handout; make sure you have one or get it here and print a copy.

Understand how to evaluate both arithmetic and logical expressions: know the usual operators, their precedence, and how they are defined for the types int, float, and str. Be sure to know the difference between numbers of int and float and the results of the division operators /, //, and %. What happens when you use both integers and real numbers in a computation?  Be able to identify the type of the value resulting from evaluating an expression.
 
Be able to do type conversion and identify situations when it might be required (for example, to convert a value to the string type before using concatenation). Know the names of functions used to do type conversions (many examples used in conjunction with the input function).

Graphics

Be familiar with the different types of graphics objects we've used the most - GraphWin, Point, Circle, Text, Rectangle, Line - and the common methods that operate on them. You should be able to write short bits of code to create some simple shapes in a window.

Selection and Iteration

Know how to construct boolean expressions for conditions in selection statements and how to use each variation on the form if...elif...else properly; be sure where the colons go! Know how the bool data type can be used. Understand the basics of iteration using for with sequences as described in the Zelle text, ThinkCSPY 4.4 and following, examples from the homeworks, and other exercises.

Sequences

Know your sequence types! We'll have seen lists, strings, tuples, and files (but files won't be on the exam). Know the differences - which are immutable? how they are represented? We've worked with lists&strings most, and tried out some of the more common operations on them. Pay attention to the models in the two sequence exercises done in class (solutions to be posted).

What Else to Expect

Your primary coding task will be reading code: evaluating short expressions and determining the output of short Python scripts. There will be one or two questions that require you to write short programs. These could feature anything covered except writing functions, which we have not practiced enough, or using functions or methods that haven't been on a lab, homework or in-class exercise. Which reminds me: make sure you have a copy of the programs your team developed in lab, so you can look those over.

Questions?

If at any time you find that you cannot do a homework problem or understand a concept, contact me. Send as many questions as necessary to clear up anything you can't figure out on your own.

Come Equipped

You may bring your own notes and handouts (no sharing).  No laptops, magnifying lenses, or iPhones needed or allowed; caffeinated beverages optional.  I assume you can do high school math computations on paper.