FfinalExam Example Soln Cache
FfinalExam Example Soln Cache
FfinalExam Example Soln Cache
Name:__________________________________
ID: ___________________________________
Notes:
1) The final exam is open book, open notes. No electronic aides. You can bring print
outs of the python lab solutions, lecture notes, etc.
2) You have 2 hours, no more.
3) Please write your name at the top right of each page you turn in!
4) Please, check your work! If possible, show your work when multiple steps are involved.
Part I
(these questions are multiple choices; in each case, find the most plausible answer)
a. 10
b. 55
c. ‘55’
d. ‘10’
1
Name:__________________________________
ID: ___________________________________
5) Which of the following are executed by the BIOS (check all that applies):
a. Memory test
b. Load application software
c. Print a test page on the printer
d. Load the operating system
8) If a 5 minute song is sampled at 44 kHz, and each sample is stored as two 8 bit numbers
(stereo), it will need that much space:
(44,000 sample/sec)(2bytes/sample)(60sec/min)(5min)=26,400,000 bytes
(and there are 1,049,000 bytes in a Megabyte)
a. 211.2 Mbytes
b. 26.4 Mbytes
c. 2.64 Mbytes
d. 13.2 Mbytes
9) What is a NIC?
a. Network Interface Card
b. Network Interference Control
c. No Internet Connection
d. New Infrared Controller
10) Which binary number comes right after the binary number 101001?
a. 101002
b. 101011
c. 101010
d. 101100
2
Name:__________________________________
ID: ___________________________________
a. A=4
b. A=3
c. A=1
d. A=5
14) After running this Python command, what is the value of A, assuming the input was 6.8?
A=raw_input(“Enter the value of the variable A -> “) raw_input always returns a scalar str
a. 6.8
b. 6
c. “6.8”
d. 7
15) If your computer has the IP address 128.96.10.123, and the subnet mask is set to
255.255.0.0, your computer will connect directly to all computers whose IP address starts
with
a. 128
b. 128.96
c. 128.96.10
d. 128.96.10.12
3
Name:__________________________________
ID: ___________________________________
Part II
1) For each category on the left in the table below, provide three examples on the right.
Category Examples
Internet protocols HTTP
SMTP
FTP
4
Name:__________________________________
ID: ___________________________________
2) The table below contains valid Python expressions on the left. For each of these expressions,
give the value of the variable A on the right. The order of operations matter! Python prioritizes
so that it performs *, /, %, then +, - operations. Note, it honors grouping into parenthesis.
L=‘a’ A = ‘aaaaa’
A=L*5
3) The Python module written below reads in an integer number N given by the user, and outputs
all integer divisors of N between 1 and N (included). Unfortunately, as written, this program
does not work. It contains 5 mistakes, either simple typos or conceptual. Please find all these
mistakes:
count = 0
for factor in range(1,N) : Error 2 missing colon, Error 3 range(1,N+1) to go from 1 to N.
if N/factor = 0 : Error 4 need logical operator “==” not “=”
count = count + 1 Error 5, need float(N)/float(factor), currently integer division
print factor
5
Name:__________________________________
ID: ___________________________________
Part III.
For example, the sentence : This is a test would be scrambled to: sihT si a tset
def exFunction():
words = s.split() # Make the scalar str s into an array (of type str) stored in variable words
print finalSentence
return finalSentence
6
Name:__________________________________
ID: ___________________________________
Example: if the string is ‘1 2 4 5’ it would return 12. If the string is ‘2 4 5 6’ it would return 240.
def simpleSum():
nums = raw_input('Enter a list of numbers with each number separated by a space:\n')
nums = nums.split()
for j in range(len(nums)):
nums[j] = int(nums[j]) #Finished converting to a list of ints