CMIS 102 University of Maryland Function Compute Returns Questions
Question Description
I’m working on a python test / quiz prep and need an explanation to help me study.
See Attachment
Question 1 (10 points
undefined
Which of the following best describes what the function compute returns?
def compute(n):
i = n
sum = 0
while i <= 10:
sum = sum + i
i = i + 1
return sum
Question 2 (10 points)
undefined
What would be output by the following statements?
result = None
for value in [8, 3, 91, 13, 49, 19]:
if result is None or value >= result:
result = value
print(result)
Question 3 (10 points)
undefined
Which of the following while loops will be an infinite loop?
Question 4 (10 points)
undefined
Which of the following best describes what the function compute returns?
def compute(values):
result = None
for value in values:
if result is None or value < result:
result = value
return result
Question 5 (10 points)
undefined
What would be output by the following statements?
result = 0
for value in [12, 5, 3, 13, 40]:
result = result + 1
print(result)
Question 6 (10 points)
undefined
Which of the following programs would output the largest element in the list named values?
Question 7 (10 points)
undefined
Which of the following programs would output the sum of all the elements in the list [22, 4, 11, 3, 17]?
Question 8 (10 points)
undefined
What would be output by the following statements?
n = 5
while n >= 2:
print(n + 1)
n = n – 3
Question 9 (10 points)
undefined
Which of the following programs will output this sequence of numbers? 2 3 4 5 6
Question 10 (10 points)
undefined
Which of the following functions would return the smallest value in a list named numbers passed as a parameter?
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."