CS A109 Midterm Exam Topics
The CS109 midterm and
final are open book
and open notes. However, they are not open-neighbor! You will not be allowed to use
a computer for this exam. You will have a variety of questions -
there will be a small number of short-answer questions. There will be more
questions where you will be asked to write some code, or you will be given some
code and asked to produce what the output of the code will be when executed.
The topics that will be covered are listed below:
Introduction to Computers
- Concept of encoding different kinds of data using
bits/bytes
- How pictures are represented and encoded using the RGB model
- Coordinate system for pixels
- Generations and levels of programming languages
Basic Operators
- How to do addition, subtraction, multiplication,
division, exponent, modulus
- Precedence of the arithmetic operators
- Division with integers: everything thrown away
after the decimal point
- How to write a function in JES and execute it in the
command window
- How to assign a value to a variable
Picture and File Functions
- You should know what these functions do:
- pickAFile
- makePicture
- show
- makeColor
- distance
- getColor, setColor
- getRed, setRed
- getBlue, setBlue
- getGreen, setGreen
- getPixels
- getWidth
- getHeight
- range
Control Structures
- How to use a for loop to process all pixels
- How to use a for loop in conjunction with "range" to process a specific
area of pixels
- Nested for loop (a loop in a loop)
- Concept of a block in python
- How to use an if statement to execute specific code if a condition is
true
- Using <, >, <=, >=, <>, and == for
comparison
Defining Functions
- How to define a function
- Purpose of "return"
- How to define a function with 0, 1, 2, etc. number of parameters
- How to invoke a function with an arbitrary number of parameters
- Concept of local scope for a variable defined in a function
- Good design for functions
- Properly named
- Does one thing
- Generalized
- Be able to trace through a program where a function calls another function
calls another function....
Manipulating Colors
- Changing the amount of red/green/blue in an image, or in specific
locations
- Converting to grayscale
- Inverting an image
Transforming Pixels
- How mirroring and flipping works
- Copying an image
- Copying an image to a different location on the target
- Scaling an image up or down
- Blending via averaging
- How chromakey works
Not on the exam