-
Describe the five program structure/flow
abstractions mentioned in the text.
___________ |
___________ |
___________ |
___________ |
___________ |
-
Describe the five hardware
abstractions mentioned in the text.
___________ |
___________ |
___________ |
___________ |
___________ |
- Fill in the blank:
- "Computers are t________s, and computing scientists are t___________s."
- A procedure that invokes itself is called a _________________ procedure.
- In statically-typed languages, before we can use the value of a
variable for the first time in
a program, we need to
________________ and ___________________ it.
- True or False (circle one): The word define
is a legal Python identifier.
- What English part of speech should a variable generally be? ___________
- Assume myFile is a file handle that has already been opened
for reading. We wish to ensure that the next read() starts from
the beginning of the file. What command do we use (including any arguments)?
______________________
- The standard function that converts strings to ALL-CAPS is found in the
_______________ standard library and is named _______________ .
- The standard function that evaluates natural logarithms is found in the
_______________ standard library and is named _______________ .
- The standard error I/O channel is found in the
_______________ standard library and is named _______________ .
- A requirement imposed by a function upon its parameters, such that
the correctness of the result is not guaranteed if the requirement is
not met, is called a _______________________ .
- A RAM module contains 32 chips, each of size 256Mb. What is the
total capacity of the RAM module, in bytes/kilobytes/megabytes/gigabytes
(use binary units)? _________________ .
-
Name two operations/functions/properties that Python lists have that
M2/C arrays do not.
-
Explain all the differences between the following, and give examples of each:
- reserved words:
- standard identifiers:
- standard library items:
-
What is a backtrace?
-
Assume that the positive integer with binary representation
1100101 is stored in variable x. Evaluate as Python:
- hex(x)
- oct(x)
-
Use the Python range() function to create this list:
[ 11, 8, 5, 2 ].
-
Write Python code to create a 15x25 matrix, using lists.
-
What is wrong with the following block of Python code?
How would you fix it?
apples = [ 'Fuji', 'Gala', 'Braeburn', 'Rome' ]
idx = 1
while idx <= len(apples):
print apples[idx],
idx += 1
-
Evaluate each of the following Python expressions
exactly as given,
or if it produces an error, describe the error.
Assume each expression is independent of the others.
Assume all necessary imports have been done.
For all expressions, assume the following initialization:
myApple = "Braeburn"
- 2 + 3>4 and (5/0 < 1)
- 2.0 + 14 / 4
- "%03d%s" % (27.95, 'apples')
- "%05.2f" % 3.1415926
- len(myApple) = 7
- range(len(myApple))
- myApple[2:5]
- string.upper(myApple[-1])
- myApple < "Brayburn"
- 'z' < 'w'
- ord('z') - ord('w')
- 'z' - 'w'
- 'z' + 'w'
- 6 & 5
-
What is output by the following block of Python code?
def increment(x, y):
x += y
a = 3
b = range(3)
increment(a, 1)
increment(b, [1])
print "a = ", a, "b = ", b
-
What is output by the following block of Python code?
myList = [ ('a', 'b'), range(5), [ [2, 3, 4], 5], 'xyz' ]
for item in myList:
print len(item),
-
Assume that myList is a Python list. Explain all the differences
between
yrList = myList and yrList = myList[:].
-
Tell me everything you know about libraries in the context of
programming.