Assume that d is a Python dictionary. What does the following Python code
produce?
d.items()
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
What output w
...
Assume that d is a Python dictionary. What does the following Python code
produce?
d.items()
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
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 11 34 17 52 26 13 40 20 10 5 16 8 4 2
CS 1101 Programming Fundamentals - Term 3, 2018-20193/28/2019 Final Exam
https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 2/4
Question 3
Answer saved
Marked out of
1.00
Question 4
Answer saved
Marked out of
1.00
What output will the following Python commands produce?
n = 1000
count = 0
while n:
count = count + 1
n = n // 10
print (count)
Select one:
a. 0
b. 4
c. 5
d. 1000
e. 10000
This Python code:
for fruit in ["banana", "apple", "quince"]:
print (fruit)
will produce this output:
banana apple quince
Select one:
True
False3/28/2019 Final Exam
https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 3/4
Question 5
Answer saved
Marked out of
1.00
Question 6
Answer saved
Marked out of
1.00
Question 7
Answer saved
Marked out of
1.00
What is the output of the following Python program?
index = "Ability is a poor man's wealth".Õnd("w")
print(index)
Select one:
a. 24
b. 0
c. 23
d. -1
Given a Python dictionary d and a value v, it is eÞcient to Õnd the
corresponding key: d[k] = v.
Select one:
True
False
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. 133/28/2019 Final Exam
https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 4/4
Question 8
Answer saved
Marked out of
1.00
Question 9
Answer saved
Marked out of
1.00
Question 10
Answer saved
Marked out of
1.00
◄ Review Quiz
Jump to...
Python tuples are mutable.
Select one:
True
False
Generally speaking, Õlter list operations produce a diàerent number of list
elements compared to map operations.
Select one:
True
False
In Python, a list of characters is the same as a string.
Select one:
True
False
[Show More]