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

Your assignment will have four parts. Before working on this assignment, you will need to complete the Unit III Activity: Word Advanced Features. Part 1: Introduction Begin your assignment with

Your assignment will have four parts. Before working on this assignment, you will need to complete the Unit III Activity: Word Advanced Features. Part 1: Introduction Begin your assignment with an introduction that identifies what a computer, storage, and networking are. Introduce internal, input, and output devices of a computer.

In Units V, VI, and VII, you learned about the components of a computer, how a computer works, the internet, networks and network communications, cloud computing, web development, digital identity, so

In Units V, VI, and VII, you learned about the components of a computer, how a computer works, the internet, networks and network communications, cloud computing, web development, digital identity, social media, e-commerce, ethical behavior, databases, and explored two Microsoft Office applications, PowerPoint and Access.  In this assignment, you will

In Units I, II, and III, you learned about the history of computers, application and system software, blockchain, cryptocurrency, computer ethics, and explored two Microsoft Office applications, Word

In Units I, II, and III, you learned about the history of computers, application and system software, blockchain, cryptocurrency, computer ethics, and explored two Microsoft Office applications, Word and Excel.  In this assignment you will demonstrate what you have learned in these three units. This assignment will have five parts. 

Assignment Tasks Part 1  Choose an organization or company of your choice.  Provide a clear description of the organization, including: o Mission o Vision o Objectives  Identify and describe the ma

Assignment Tasks Part 1  Choose an organization or company of your choice.  Provide a clear description of the organization, including: o Mission o Vision o Objectives  Identify and describe the main business processes in this organization.  Looking at the business processes, point out an issue that

Write 200-250 words on the following topic. Be sure to cite the readings and lectures. Topic: Select two international organizations and explain what role they play in promoting, monitoring, investig

Write 200-250 words on the following topic. Be sure to cite the readings and lectures.  Topic: Select two international organizations and explain what role they play in promoting, monitoring, investigating, and/or enforcing human rights. Use at least one concrete example of a human rights issue (e.g. allegations of war crimes

DFA Closure: 1.4 c and f. Do union and intersection for each (use cross product algorithm) Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs fo

DFA Closure: 1.4 c and f. Do union and intersection for each (use cross product algorithm) Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs for the simpler languages, then combine them using the construction discussed in footnote 3 (page 46) to

DFA Closure: 1.4 c and f. Do union and intersection for each (use cross product algorithm) Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs fo

DFA Closure: 1.4 c and f. Do union and intersection for each (use cross product algorithm) Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs for the simpler languages, then combine them using the construction discussed in footnote 3 (page 46) to

1.2 Lab – More Charts in Excel Submission: Completed Excel workbook via Canvas. Part 1 – Multiple Variable Charts Overview • This problem furthers the ideas from the notes ‘1.2 – Basic Charts in Excel

1.2 Lab – More Charts in ExcelSubmission: Completed Excel workbook via Canvas.Part 1 – Multiple Variable ChartsOverview• This problem furthers the ideas from the notes ‘1.2 – Basic Charts in Excel’, where we learnedhow to create and format many simple charts in Excel.• The first tab of the accompanying workbook

TNM1 — Task 2: Multipage Website Prototype User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The grad

TNM1 — Task 2: Multipage Website Prototype User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The grad TNM1 — Task 2: Multipage Website Prototype User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The graduate

In Units I, II, and III, you learned about the history of computers, application and system software, blockchain, cryptocurrency, computer ethics, and explored two Microsoft Office applications, Word

In Units I, II, and III, you learned about the history of computers, application and system software, blockchain, cryptocurrency, computer ethics, and explored two Microsoft Office applications, Word and Excel.  In this assignment you will demonstrate what you have learned in these three units. This assignment will have five parts. 

TNM1 — Task 2: Multipage Website Prototype User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The grad

TNM1 — Task 2: Multipage Website Prototype User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The graduate describes user interface design project constructs. 4040.01.2 : User Interface Design Process The graduate describes the user interface design process. 4040.01.3 : User Centered Web Design The graduate explains the

TNM1 — Task 1: Project Proposal with Strategies User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The

TNM1 — Task 1: Project Proposal with Strategies User Interface Design — C773 PRFA — TNM1 PreparationTask OverviewSubmissionsEvaluation ReportCompetencies 4040.01.1 : User Interface Design Projects The graduate describes user interface design project constructs. 4040.01.2 : User Interface Design Process The graduate describes the user interface design process. 4040.01.3 : User Centered Web Design The graduate explains

TNM1 — Task 2: Multipage Website Prototype Competencies 4040.01.1 : User Interface Design Projects The graduate describes user interface design project constructs. 4040.01.2 : User Interface Design Pr

TNM1 — Task 2: Multipage Website Prototype Competencies 4040.01.1 : User Interface Design Projects The graduate describes user interface design project constructs. 4040.01.2 : User Interface Design Process The graduate describes the user interface design process. 4040.01.3 : User Centered Web Design The graduate explains the relationship between the user and the site design. 4040.01.4 : User Interface

IntroductionUser interface and user experience (UI/UX) designer is one of the most popular job titles in the technology industry. UI/UX designers tend to enjoy the challenges associated with creating

IntroductionUser interface and user experience (UI/UX) designer is one of the most popular job titles in the technology industry. UI/UX designers tend to enjoy the challenges associated with creating products that people love. Industry leaders know that design is a substantial competitive advantage, and they are competing for best talents;

In Units V, VI, and VII, you learned about the components of a computer, how a computer works, the internet, networks and network communications, cloud computing, web development, digital identity, so

In Units V, VI, and VII, you learned about the components of a computer, how a computer works, the internet, networks and network communications, cloud computing, web development, digital identity, social media, e-commerce, ethical behavior, databases, and explored two Microsoft Office applications, PowerPoint and Access.  In this assignment, you will