This review list is meant to give you an idea of the types of questions and topics that will be covered. It is by no means an exhaustive list. The actual exam will possibly contain questions and/or coding problems similar to those in this review guide, IN ADDITION to questions and/or coding problems related to any material gone over in lecture, group exercises, labs, homework assignments, course lecture notes, etc.
a = 3
b = 17
a = b % a
a += 1
b = a + 5
print "a = %d, b = %d\n" % (a, b)
a = 4
b = 3
c = 1
if a < b + 1:
print "Stop and smell the roses"
elif a > b + c:
print "Type A personality"
elif a % b >= c:
print "What doesn't kill me, makes me stronger"
else:
print "I sense a lot of anxiety in this room."
for i in range(1, 16):
if i % 3 == 0:
print i
str = "Hello Class"
print str[6]
print str[3:]
print str[7:11]
print str[-1]
if temp < 32:
print "ice"
elif temp < 212:
print "water"
else:
print "steam"
def mickey (x, y):
z = x - y
print "mickey: x = %d, y = %d, z = %d" % (x, y, z)
return z
def mouse (c):
a = 1
b = c * 2 + a
a = b + 5
c = mickey (a, b)
print "mouse: a = %d, b = %d, c = %d" % (a, b, c)
return b
def main():
a = 2
b = 3
c = 3
a = mickey (b + 5, c)
b = mouse (c)
print "main: a = %d, b = %d, c = %d" % (a, b, c)
main()
for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print "+",
else:
print "o",
print
def findNet ( hours, ________, _______ ):
STANDARD_HOURS = 40
TAX_BRACKET_AMT = 1000
HIGH_TAX_RATE = ________
LOW_TAX_RATE = ________
if _______ > STANDARD_HOURS _____ not exempt:
extraHours = hours - STANDARD_HOURS
grossPay = STANDARD_HOURS * _______ + extraHours * payRate * ______
else:
grossPay = hours * _______
if grossPay > _____________ :
netPay = grossPay - grossPay * _______
_________
netPay = grossPay - grossPay * _______
________ "Hours = %d and Net Pay = _______" % (hours, netPay)
________ __________
a = 2
b = 3
b *= a
a += b
print "%d %d" % (a, b)
m = 5
n = 8
print "%d %d" % (m % n, n % m)
def f(x):
print x,
def g(x):
f(x + 1)
print x,
def main():
g(4)
f(5)
g(6)
main()
def x(m):
print "x: %d" % (m)
return m + 2
def y (n):
print "y: %d %d" % (n, x(n))
return n * 3
def main():
r = x(12)
s = y(7)
print "main: %d %d" % (r, s)
main()
x = 1
if x > 3:
if x > 4:
print "A",
else:
print "B",
elif x < 2:
if (x != 0):
print "C",
print "D"
for g in range (1, 4):
for h in range (3):
if g == h:
print "O",
else:
print "X",
print
def f1(a, b):
print "f1: %d %d" % (a, b)
return a
def f2(b, c):
print "f2: %d %d" % (b, c)
return c
def main():
a = 2
b = 5
c = 7
c = f1(a, b)
print "main: %d %d %d" % (a, b, c)
b = f2(a, c)
print "main: %d %d %d" % (a, b, c)
main()