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

Hello This is XP Cyberrange Challenges twe need to complete the challenge by reading a conversaation between the people dicussing on cyber topics. We need to resolve the issues by working on each task

Hello This is XP Cyberrange Challenges we need to complete the challenge by reading a conversaation between the people dicussing on cyber topics. We need to resolve the issues by working on each task which are discussed in that conversation meet. Please pay attention to the instructions below. Finish the

● NCP- NICE Challenge Project ● VM- Virtual Machine ● VMRC- Virtual Machine Remote Console ❖ NICE Framework- This is shorthand for the NICE Cybersecurity Workforce Framework. ❖ Webportal- The web appl

Hello friends this is the step by step guidance to work on task these are not the questions don’t be panic ./ ● NCP- NICE Challenge Project ● VM- Virtual Machine ● VMRC- Virtual Machine Remote Console ❖ NICE Framework- This is shorthand for the NICE Cybersecurity Workforce Framework. ❖

Course : Analyzing and Visualizing Data Textbook Used: Title: Data VisualisationISBN: 9781526468925Authors: Andy KirkPublisher: SAGE Publications LimitedPublication Date: 2019-10-07Edition: 2nd ED.

Course : Analyzing and Visualizing Data Textbook Used: Title: Data VisualisationISBN: 9781526468925Authors: Andy KirkPublisher: SAGE Publications LimitedPublication Date: 2019-10-07Edition: 2nd ED. Practical Connection Assignment At UC, it is a priority that students are provided with strong educational programs and courses that allow them to be servant-leaders in their disciplines and communities, linking research with practice and

Hello Students, As discussed in class, the Workspaces and Challengesare now active. Required Challenges for Full Credit To earn full credit (30% of the assignment), you must complete 6 challenges from

Hello Students, As discussed in class, the Workspaces and Challengesare now active. Required Challenges for Full Credit To earn full credit (30% of the assignment), you must complete 6 challenges from the following list: Interns & HR on the Domain Controller Help Desk Fun: User Workstation Nightmares Dangerous Drives Preventative Protection: Thwarting the Imminent Threat Security

Part 1Title: Computer Hardware Using bullet points, briefly describe a computing device you use often, such as your desktop, laptop, tablet, or smartphone. Identify the make and model, and at least th

Part 1Title: Computer Hardware Using bullet points, briefly describe a computing device you use often, such as your desktop, laptop, tablet, or smartphone. Identify the make and model, and at least three other components of the computing device. In the speaker notes, discuss in detail what you use the device

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confident

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confidentiality, or some other high-profile attack. Find a news article about a recent network attack (no more than one year ago).

I am doing IFSM 300 Information Systems in Organization. the instructions The Stage 4 case study project is due as shown in the schedule. The assignment instructions and vendor brochure are attached.

I am doing IFSM 300 Information Systems in Organization. the instructions The Stage 4 case study project is due as shown in the schedule. The assignment instructions and vendor brochure are attached. The Case Study is posted under Course Resources. Use the Case Study and weekly readings to develop your assignment and understand the concepts

Find 5 student organizations that interest you. For each organization: Why are you interested in this organization?Describe some of the activities of the organizationWhen and where is the next meeti

Find 5 student organizations that interest you.  For each organization: Why are you interested in this organization? Describe some of the activities of the organization When and where  is the next meeting? If you have questions about the organization, how would you contact them?CSE1106 – Intro to Computer Science and