Select Page

Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!     ## 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.

## 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 1 options:
 It returns the sum of integers from n+1 to 10 It returns the sum of integers from n to 10 It returns the sum of integers from n to 9 It returns the sum of integers from n+1 to 9

## 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 2 options:
 3 8 91 19

## Question 3 (10 points)

undefined

Which of the following while loops will be an infinite loop?

Question 3 options:
 i = 10while i <= 25: print(i) i = i + 1 i = 10while i <= 20: print(i) i = i – 1 i = 10while i > 0: print(i) i = i – 1 i = 5while i >= 15: print(i) i = i – 1

## 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 4 options:
 It returns the largest value in the list values It returns the smallest value in the list values It returns the number of elements in the list values It returns the sum of all the elements in the list values

## 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 5 options:
 14.7 5 15 73

## Question 6 (10 points)

undefined

Which of the following programs would output the largest element in the list named values?

Question 6 options:
 values = [13, 65, 11, 34, 58]largest = Nonefor value in values: if largest is None or value < largest:largest = iprint(largest) values = [13, 65, 11, 34, 58]largest = Nonefor value in values: if largest is None or value > largest: largest = valueprint(largest) values = [13, 65, 11, 34, 58]largest = Nonefor value in values: if largest is None or value != largest: largest = valueprint(largest) values = [13, 65, 11, 34, 58]largest = Nonefor value in values: if largest is None or value == largest: largest = valueprint(largest)

## 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 7 options:
 sum = 0for value in [22, 4, 11, 3, 17]: sum = valueprint(‘Sum:’, sum) sum = 0for value in [22, 4, 11, 3, 17]: sum = sum + valueprint(‘Sum:’, sum) sum = 0for value in [22, 4, 11, 3, 17]: sum = 1print(‘Sum:’, sum) sum = 0for value in [22, 4, 11, 3, 17]: sum = sum + 1print(‘Sum:’, sum)

## 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 8 options:
 63 6 3 54

## Question 9 (10 points)

undefined

Which of the following programs will output this sequence of numbers? 2 3 4 5 6

Question 9 options:
 n = 2while n < 6: print(n) n = n + 1 n = 2while n <= 6: print(n) n = n + 1 n = 2while n <= 6: print(n) n = n – 1 n = 2while n < 6: n = n + 1 print(n)

## Question 10 (10 points)

undefinedSaved

Which of the following functions would return the smallest value in a list named numbers passed as a parameter?

Question 10 options:
 def minimum(numbers): smallest = None for number in numbers: if smallest is None or number < smallest: smallest = number return smallest def minimum(numbers): smallest = 0 for number in numbers: smallest = smallest + number return smallest def minimum(numbers): smallest = None for number in numbers: if smallest is None or number > smallest: smallest = number return smallest def minimum(numbers): smallest = 0 for number in numbers: if number > 0: smallest = smallest + 1 return smallest ## Our Service Charter

1. Professional & Expert Writers: Executive Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Executive Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Executive Papers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Executive Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime. 