Boston University College Of Arts And Sciences
Latest uploads at Boston University College Of Arts And Sciences. Looking for notes at Boston University College Of Arts And Sciences? We have lots of notes, study guides and study notes available for your school.
-
149
- 0
-
5
All courses for Boston University College Of Arts And Sciences
Latest notes & summaries Boston University College Of Arts And Sciences
Question 1 
Not yet answered 
Marked out of 
1.00 
Question 2 
Not yet answered 
Marked out of 
1.00 
The Python code below is an example of recursion: 
def fa(): 
 fb() 
def fb(): 
 fa() 
fa() 
Select one: 
True 
False 
What output will the following code produce? 
n = 10 
while n != 1: 
 print (n,) 
 if n % 2 == 0: # n is even 
 n = n // 2 
 else: # n is odd 
 n = n * 3 + 1 
Select one: 
a. 10 5 16 8 4 2 
b. None an error will be displayed 
c. 8 4 2 
d. 9 28 14 7 22 1
Question 21 
Answer saved 
Marked out of 
1.00 
Question 22 
Answer saved 
Marked out of 
1.00 
The invert_dict Python function is supposed to invert a 
dictionary. Based on the sample input and the output shown 
below, the function is correct. 
invert_dict({1: 10, 2: 10, 3: 20}) 
 {10: [1, 2, 3], 20: [3]} 
Select one: 
True 
False 
Boolean expressions control _________________ 
Select one: 
a. recursion 
b. conditional execution 
c. alternative execution 
d. all of the
What output will the following code produce? 
def area(l, w): 
 temp = l * w; 
 return temp 
l = 4.0 
w = 3.25 
x = area(l, w) 
if ( x ): 
 print (x) 
Select one: 
a. 13.0 
b. 0 
c. Expression does not evaluate to boolean true 
d. 13 
Which of the following types are allowed for Python 
dictionary keys? 
Select one: 
a. dictionary 
b. dictionary of lists 
c. list 
d. tuple 
e. A
class notes with key concepts and explanations of lectures.
class notes with key concepts and explanations of lectures.
class notes with key concepts and explanations of lectures.
class notes with key concepts and explanations of lectures.