Our Services

Get 15% Discount on your First Order

[rank_math_breadcrumb]

Quiz: 20 minutes. Thank you 1) Which of the following best describes what the function compute returns? def compute(values): result = 0 for value in values: result = result + value

Quiz: 20 minutes.

Thank you 

1) Which of the following best describes what the function compute returns?

def compute(values):    result = 0    for value in values:        result = result + value    return result

a-It returns the largest value in the list values

b-It returns the smallest value in the list values

c-It returns the sum of all the elements in the list values

d-It returns the number of elements in the list values

2) What would be output by the following statements?

result = 0for value in [11, 21, 7, 23, 20, 8]:    result = result + valueprint(result)

– 14

– 6

– 23

– 90

3) Which of the following functions would return the sum of all the elements in a list named numbers passed as a parameter?

a- def compute(numbers):    sum = 0    for number in numbers:        sum = sum + 1    return sum

b- def compute(numbers):    sum = 0    for number in numbers:        sum = sum + number    return sum

c- def compute(numbers):    sum = 0    for number in numbers:        if number > 0:            sum = sum + number    return sum

d- def compute(numbers):    sum = None    for number in numbers:        if sum is None or number < sum:            sum = number    return sum

4) Which of the following programs would output the number of elements in the list named values?

a- values = [2, 67, 31, 18, 12]count = 0for value in values:    count = count + 1print(‘Count:’, count)

b- values = [2, 67, 31, 18, 12]count = 0for value in values:    count = 1print(‘Count:’, count)

c- values = [2, 67, 31, 18, 12]count = 0for value in values:    count = count + valueprint(‘Count:’, count)

d- values = [2, 67, 31, 18, 12]count = 0for value in values:    count = valueprint(‘Count:’, count)

5) Which of the following best describes what the function compute returns?

def compute(n):    i = 2    sum = 0    while i < n:        sum = sum + i        i = i + 1    return sum

a- It returns the sum of integers from 1 to n-1

b- It returns the sum of integers from 2 to n-1

c- It returns the sum of integers from 1 to n

d- It returns the sum of integers from 2 to n

6) Which of the following programs would output neither the largest nor the smallest element in the list [12, 7, 94, 93, 89]?

a- largest = Nonefor value in [12, 7, 94, 93, 89]:    if largest is None or value < largest:        largest = valueprint(largest)

b- largest = Nonefor value in [12, 7, 94, 93, 89]:    if largest is None or value != largest:        largest = valueprint(largest)

c- largest = Nonefor value in [12, 7, 94, 93, 89]:    if largest is None or value > largest:        largest = valueprint(largest)

d- largest = Nonefor value in [12, 7, 94, 93, 89]:    if largest is None or value >= largest:        largest = valueprint(largest)

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

a- n = 2while n <= 6:    print(n)    n = n – 1

b- n = 2while n <= 6:    print(n)    n = n + 1

c- n = 2while n < 6:    n = n + 1    print(n)

d- n = 2while n < 6:    print(n)    n = n + 1

8) What would be output by the following statements?

n = 4while n > 1:    print(n)    n = n – 2

a- 432

b- 4c- 4 2

d- 4321

9) What would be output by the following statements?

result = Nonefor value in [8, 3, 91, 13, 49, 19]:    if result is None or value >= result:        result = valueprint(result)

a- 19

b- 91

c- 8

d- 3

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

a- i = 10while i <= 20:    print(i)    i = i – 1

b- i = 10while i <= 25:    print(i)    i = i + 1

c- i = 10 while i > 0:    print(i)    i = i – 1

d- i = 5while i >= 15:    print(i)    i = i – 1

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

HTML Basics: A Beginner’s Guide HTML (HyperText Markup Language) is the standard language used to create web pages. It provides the structure for web content, allowing you to define elements like head

HTML Basics: A Beginner’s Guide HTML (HyperText Markup Language) is the standard language used to create web pages. It provides the structure for web content, allowing you to define elements like headings, paragraphs, links, images, and more. Here’s a concise guide to help you get started with HTML. 1. Structure

Introduction to Python: A Beginner’s Guide Python is a powerful, versatile programming language that has gained immense popularity among developers, data scientists, and educators. Its simple syntax a

Introduction to Python: A Beginner’s Guide Python is a powerful, versatile programming language that has gained immense popularity among developers, data scientists, and educators. Its simple syntax and readability make it an ideal choice for beginners. In this tutorial, we’ll cover the basics of Python, including variables, data types, and

Unit VII PowerPoint Presentation Question Your manager at work is extremely impressed with your computer skills since you took a computer course. The company is installing computers in its production

Unit VII PowerPoint Presentation Question  Your manager at work is extremely impressed with your computer skills since you took a computer course. The company is installing computers in its production facility, and she has asked you to create a brief PowerPoint presentation that shows tips for working in the new

Hide Assignment InformationTurnitinThis assignment will be submitted to Turnitin.InstructionsFor this project, you will apply the CompTIA 6-Step Troubleshooting Process to explain how you would tackle

Hide Assignment InformationTurnitinThis assignment will be submitted to Turnitin.InstructionsFor this project, you will apply the CompTIA 6-Step Troubleshooting Process to explain how you would tackle Hudson Fisher Associates Help Desk Tickets. There are three groups of tickets, Level 1, Level 2, and Level 3. You will pick two tickets from

This week's module covered some of the cloud monitoring and autoscaling techniques. You were able to use CloudWatch, one of the AWS cloud monitoring tools. Think about how you might use Clou

This week&#39;s module covered some of the cloud monitoring and autoscaling techniques. You were able to use CloudWatch, one of the AWS cloud monitoring tools. Think about how you might use CloudWatch in your deployment as you answer the following questions. In addition to your primary forum response, post at

For this project, you will apply the CompTIA 6-Step Troubleshooting Process to explain how you would tackle Hudson Fisher Associates Help Desk Tickets. There are three groups of tickets, Level 1, Leve

For this project, you will apply the CompTIA 6-Step Troubleshooting Process to explain how you would tackle Hudson Fisher Associates Help Desk Tickets. There are three groups of tickets, Level 1, Level 2, and Level 3. You will pick two tickets from each group. As you prepare to analyze and hopefully

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet research you conducted, submit your recommendation

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet research you conducted, submit your recommendation to the assignment folder. As you are writing your recommendation, ensure your analysis and recommendations align with your manager’s priorities and concerns.

The CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders started with the CompTIA A+, and that led t

The CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders started with the CompTIA A+, and that led them to higher-paying, more complex jobs in both IT and cybersecurity. Many large corporations such as Apple, Cisco, Microsoft, and

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space complexity** are two of the most significant variables t

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space complexity** are two of the most significant variables to consider. Although they both gauge an algorithm’s efficiency, they focus on distinct areas of performance.**Time complexity** is the relationship between an algorithm’s execution

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders sta

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders started with the CompTIA A+, and that led them to higher-paying, more complex jobs in both IT and cybersecurity. Many large corporations such as Apple, Cisco,

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako (connectivity issue). Use the CompTIA 6-step troublesh

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako (connectivity issue). Use the CompTIA 6-step troubleshooting process below to help figure out the connectivity issue. CompTIA 6-Step Troubleshooting Process: Identify the problem. Establish a theory of probable cause. Evaluate the theory