Exam 1 will be Wed October 14 during normal class time in our same room. The exam will be written, no notes, no calculator, just pencil/pen/eraser and paper. There should be around 5 to 6 problems on the exam.
The material covered will be Day 1 up to and including Day 15. Anything I mentioned in class can potentially be on the exam, and the notes for each day mostly cover what I talked about. Look back at the pages for the lectures to see all the topics, but the highlights are:
Basic Computer Architecture: the 5 components of the von Newmann arch, fetch-decode-execute, binary numbers, role of the operating system (scheduling, memory management, syscalls)
Computer Science: binary numbers and converting, what is a programming language?, syntax versus semantics, BNF, boolean algebra and De Morgan's Laws, encryption, substitution cipher, frequency analysis.
Python basics: integers, strings, floating point, assignment statements, lists, dictionaries, booleans, comparison operators, if, for, while, functions, namespaces.
There will be a couple short-answer problems, where I ask you to write three to five sentences about one of the topics covered. For example,
Those are just examples, any of the topics we have covered could have questions about them. Next, there will be a problem or problems asking you to write down a few lines of python code. Since you can't run the code, I will give partial credit if your code has syntax errors. Here you want to make sure you indent enough so that I can see the code indented.
Notice that all of the above problems can be done using at most four to five lines of code and the exam problems will be similar. Finally, there might be a problem where I give you some python code and ask you to write some sentences explaining what the code is doing.
Try it by typing it into python: 34/87
is zero and 34.0/87
is 0.39080459770114945
. The difference is 34/87
uses integers which python rounds to an integer (in this case zero) and the other uses floating point numbers.
Check the day summary pages for fetch-decode-execute, cyphers, scheduling.
12 as a bit sequence is 1100
. The bit sequence 101101
is 1 + 4 + 8 + 32 = 45
.
x | y | (x or y) | (x and not(y)) | (x or y) and (x and not(y)) |
---|---|---|---|---|
T | T | T | F | F |
T | F | T | T | T |
F | T | T | F | F |
F | F | F | F | F |
Compute the number of nonnegative entries
def count_nonneg(L):
c = 0
for x in L:
if x >= 0:
c = c + 1
return c
Here is the mean
def mean(L):
total = 0.0
for x in L:
total = total + x
return total/len(L)
Here is the median (this is just slightly more complicated than a function that might appear on the exam but is good practice).
def median(L):
L.sort()
if len(L) % 2 == 1: # odd length
return L[len(L)/2]
else:
x1 = L[len(L)/2 - 1]
x2 = L[len(L)/2]
return (x1+x2)/2.0
Phone numbers
s = "312 996 3041"
area = s[0:3]
t = "(" + area + ")" + s[4:7] + s[8:]