The
CS109 final is open book and open notes. However, they are
not open-neighbor! You will not be allowed to use a computer for this
exam. The emphasis is on material
covered since the midterm,
although you might be
presented with some code that uses graphics. 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. You have the full 2 hours and 45 minutes to complete the final.
The topics that will be covered are listed below:
Speed
Machine, assembly, vs. higher level language
Concept of a compiler, interpreter, and virtual machine
Why python programs can sometimes run so
slow
Why you would want to use a virtual machine
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
What happens if a parameter to a function is a list, and the function
changes the values in the list
Concept of local scope for a variable defined in a
function
Be able to trace through a program where a function calls another function
calls another function....
Sound
Understand how sound is encoded in the
computer
Concept of frequency,
sampling
Processing every sample in an audio
file
Changing
volume
Changing
frequency
Result if frequency doubled? How big will the
new sound file be compared to the original?
Result if frequency cut in half? How big will the new sound file be compared to the
original?
Processing a selected range in an audio file, using a FOR loop and
RANGE
Splicing sounds
Backwards sound
Making an
echo
Strings
How strings are represented in the
computer
Escape
characters
Accessing substrings using
[]
Common string functions, e.g. upper(), lower(), find(),
replace()
How to input a string using a pop-up
window
How to convert a string to an integer or
float
Loops
How to construct a while
loop
How to use a for
loop
Nested loop: a loop within a
loop
Files
How to open and read from a text
file
Reading one line at a time vs. reading the whole file at
once
How to process a text file line by
line
Random Numbers
What random.randint(x,y)
does
Lists
How to create a
list
Adding on to the end of a
list
Accessing a specific element of a list using
[]
Using a list to return multiple items from a
function, e.g. as we did in the setup function for the trivia
game
Stepping through each item in a list and processing
it