CPSC 120 Principles of Computer Science Fall 2024

Exam 2 Review Information

Topics

Exam #2 will cover material up through week 10 (loops). Arrays, behavioral animation, and images will not be covered on this exam.

The primary emphasis will be on the following new topics:

However, the course material is cumulative and "old" topics are unavoidable. You should expect to see any of the topics covered by the first exam (review information here) appear on this exam as well. (As with exam 1, you will not be asked about shapes, color, or system variables not specifically listed.)

You only need to know the syntax for one kind of loop — for loops are recommended since that is what has been covered in class, but while loops are also OK.

You will not be asked about drawing self-similar shapes (fractals), recursion (also fractals), more advanced physics (air resistance and damping), constrained motion (parametric equations), or Perlin noise.

Format and Types of Questions

The exam will be in class, written (not on the computer), and closed book though you may use a single page of notes (8.5x11", one side). This page may be handwritten or typed and can contain whatever you would like, but it must be a hardcopy — printed or written on a piece of paper — and must be personally prepared by you — you may not copy another student's notes or make copies of your own for others. Creating your own notes is an essential part of the learning process — deciding what to include requires engagement with the material which reinforces understanding and improves long-term retention of the material, provides an opportunity for review in order to identify gaps in your knowledge in time to ask questions before the exam, increases confidence in what you do know, and encourages taking ownership of your own learning.

Expect to be asked to identify what pattern is applicable for particular situations involving conditionals and loops. (You won't be asked to come up with the name of the pattern off the top of your head but you will need to be able to pick out the right pattern(s) from a list.) Also expect to be asked to identify aspects or elements of the pattern e.g. what the two alternatives are in a two-alternative on-the-spot decision or what loop variables are needed.

Also expect to be asked to write Processing code to achieve a particular result (similar to the in-class exercises). You might also be asked to modify some provided code or describe what some code will do when run.

Why a written exam in a programming course? Being able to recognize when to use structures like conditionals and loops and then being able to fill in the parts of the structures (where the conditionals and loop questions come in) is at least as important for creating a working program as writing the actual code. In addition, not being able to run your code tests whether you can think about the concepts correctly instead of relying on trial and error to create a particular result and whether you can read Processing code and understand what it does without running it. These are essential foundational skills for a programmer — it is very difficult to build a program of any size purely by trial and error, and reasoning through code is important for finding and fixing problems when it doesn't do what you want.

You are expected to have correct syntax in your answers, however, because you don't have the computer to point out problems, there is some leniency — small syntax errors such as the occasional missed semicolon will not be penalized. (However, frequent mistakes of the same type or large errors that indicate a lack of understanding will lose points as these types of problems are impediments to producing a successful program.)

How to Study

The best way to study for the exam is to practice as much as you can. The in-class exercises are a good for this — work on ones you didn't get to or didn't finish in class. Start by trying to do the problems yourself, then go to office hours and/or Teaching Fellows for help if needed. Stick to the materials from class posted on the course webpage — don't use the Internet to look for other resources to help you. (Some solutions are posted. Don't look at them until after you've tried to solve the problem, and keep in mind that there can be more than one way to solve a problem — use the solutions as an example of a correct answer, not the only correct answer.)

Keep in mind that the key takeaway from this course should be the process of constructing programs — it's not about any particular end result, but rather knowing what to do to get there. Review the slides from class and in particular the conditionals and loops questions — these help you identify what to use to accomplish a task, and how to fill in the particular constructs.