Pre Final

< CS101

This is information about the final (lots of exams linked off the home page for studying. The final exam will be in our regular room, Sat June 6th, 9:30am-11:30am (2 hours). This is a closed-note exam. Just bring yourself and a couple pens.

The exam will look a lot like the midterm but twice as long: closed-note with a mix of short answer and code-writing questions spanning the whole quarter. In particular, the code writing will cover images processing, tables, and spreadsheets (spreadsheets limited to the small set of things we did on the spreadsheet homework problems). Note that the "cheat sheet" section below now includes table and spreadsheet syntax.

Writing code on a piece of paper is different from typing code into the computer, and our grading criteria take that into account. We do not grade off for trivial syntax errors that you would easily catch when running on the computer. So if you write poxel.setReeed(4); or omit one parenthesis or comma or something, we'll give full credit, so long as the key ideas of the solution are there and we can see what you meant.

The exam will contain the reference cheat sheet below listing the major phrases of syntax we have used, so you don't need to memorize the superficial details. The points on the exam will come from using the syntax to solve little problems, just like the homework. If a question requires a little rote code at the start, often the question will include that code already done, and the points will be from writing the rest of the required code.

How To Study

My advice to study for the exam is that you be comfortable with all the homework code problems and lecture code examples. You should be able to type in the code for any of these without looking at any example code. This is a higher bar than the homeworks, where you very likely scrolled back to remind yourself from earlier examples. A great way to study is to select a problem, even one you have solved before, delete any existing code, and then see if you can type in a reasonable solution just from reading the problem statement.

Code reference "cheat sheet" to be included with exam:

Image loop:
 image = new SimpleImage("something.jpg");
 for (pixel: image) {

 -pixel.setRed(val)  // likewise for green and blue
 -pixel.getRed()     // likewise for green and blue
 -pixel.getX(), pixel.getY()
 -image.getWidth(), image.getHeight()
 -image.getPixel(x, y)
 -image.setAsBig(other_image) // aka setSameSize

 if (100 > 50) {
   // body lines

Table loop:
 table = new SimpleTable("baby-2010.csv");
 for (row: table) {

Table functions:
 -s1.startsWith(s2), s1.endsWith(s2)
Table field names:
 baby: name, rank, gender, year
 survey: color, tv, movie, book, sport, soda

  =sum(B1:B10)   // sum up column of numbers
  =A1 + A2 * 10   // arithmetic based on other cells