



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Your Name (first last) SID Lab TA’s Name
ç Name of person on left (or aisle) Name of person on right (or aisle) è
Question 1: Which does NOT make the Genome assembly computing problem difficult? (select ONE)
Question 2 : What was wrong with early versions of the Google self-driving car at 4 - way stops? (select ONE)
Question 3: Prof Marti Hearst talked about what device/concept her HCI group helped invent? (select ONE)
Question 4 : What was one memorable moment from the Alumni Panel? (select ONE)
Question 5 : What is the Halting Problem? (select ONE)
Question 6: What is 4616 divided by 128 written in Binary? (select ONE)
02 12 102 112 1002 1012 1102 1112 None of these
Question 7 : We put the Fun in Functional Programming… ( 8 = 2+2+ 2 + 2 pts) SID: ______________ Consider the following two blocks and setup code: a) We’re now to going to zoom in on pixels affected by calls to Fun ; the sprite always starts in the lower left facing right, and the pen is in the center of the sprite. Your job is to shade in (completely!) all the pixels that will be colored in after calls to Fun with length set to 2 , 4 and 8 ; don’t worry about drawing the sprite at the end. Clarification: if the sprite were at (0,0) and moved 4 steps to the right, it would be at (4,0) and all pixels along the line from (0,0) through (4,0) would be shaded; 5 pixels in total. After the call to Fun ( 2 ) After the call to Fun ( 4 ) After the call to Fun ( 8 ) b) Could Fun be rewritten iteratively? (select ONE)
Question 9 : What do tablets eat for dinner? iPad Thai … ( 28 = 2*9+10 pts) Instead of a paper final exam for BJC, we decide to use tablet computers, with each of the N problems printed on separate digital “page” (screen). On each page, there’s a field for the answer and a submit button, which when clicked shows the next problem or a “ You’re done! ” screen if they’ve answered all the questions. All students start on page 1, and there’s no way to skip around or go back. When time is up, if the student is still working on a question, the system automatically clicks submit for them. The system records four pieces of information into a database ( DB ) each time submit is clicked; here’s an example that was recorded for a 2- question exam. Note that student 999 99999 fell asleep during question 1, so the system submitted it for them at the end of the exam. All the times in “Seconds since the exam started” will always be in chronological order. Unique student ID Seconds since the exam started Question # Auto-graded score for that question 12345678 60 1 9 11111111 100 1 10 11111111 110 2 5 12345678 260 2 4 99999999 600 1 2 a) Which of the following could be answered by analyzing only the data in DB after the exam is finished? (select ALL that apply)
b) Somehow the first column (Unique student ID) gets corrupted (lost). If we didn’t care about the actual student ID, but only that each student had a different ID that was consistent throughout the DB , when are we guaranteed to be able to recreate the first column using only the other values in DB? (select ALL that apply)
c) Assume the first column is fine, but now the third column (Question #) gets corrupted (lost). We want to recreate it using only the values in the “Unique Student IDs” column in the DB. That is, assuming you pulled out the first column in DB as a list called SIDs , the following function should return the third column as a list. Fill in the grid below to put up to 6 lines of python into our code on the left AND tell us where to indent the def SIDs_to_questions(SIDs): D={} questions = [] for SID in SIDs: return questions Line number Indent 1 2 3 4 5 6 A B C D E if SID in SIDs: (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ if SID in questions: (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ if SID in D: (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ questions.append(SID) (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ questions.append(D[SID]) (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ questions.append(SIDs) (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ questions.append(D[SIDs]) (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ questions.append(D) (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ D[SID] += 1 (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ D[SID] - = 1 (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ D[SID] = 1 (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ else: (^) ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
lines. Write the code in the area on the left (as a backup). You might not need all 6 lines, and if a command is not used, leave its row blank.
Question 10 : Would you like another pie[1:3]? ( 18 = 2*9 pts) a) We recreated a script of playing in the interpreter, but we may have gotten some of it wrong. For each response, indicate if it is correct, and if it’s not, what the right answer should be.
S = "1234" S[1:3]
"3" in S
[x+1 for x in range(4) if x != 2]
def mystery(word): if word[0] in "aeiou": return word+"ay" else: return mystery(word[len(word)-1] + word[0:len(word)-1])
mystery("school") "schoolay"
Correct! "oolay"^ "oolschay"^ "loohcs"^ "loohcsay"^ "olschoay"^ Error Infinite Loop
mystery("sky") "skyay"
Correct! "yay"^ "yskay"^ "yks"^ "yksay"^ Error Infinite Loop b) Assume for this problem that mystery was given a word with many characters, and returned successfully. What is its running time (as a function of the length of word )? You may also assume that slicing, concatenation and determining length are constant-time operations. (select ONE for each side)
Constant Logarithmic Linear Quadratic Cubic Exponential Reasonable Time Not Reasonable Time