subject

A programmer wrote the code segment below to display the average of all the elements in a list called numbers. There is always at least one number in the list.
Line 1: count โ† 0
Line 2: sum โ† 0
Line 3: FOR EACH value IN numbers
Line 4: {
Line 5: count โ† count + 1
Line 6: sum โ† sum + value
Line 7: average โ† sum / count
Line 8: }
Line 9: DISPLAY (average)

The programmer wants to reduce the number of operations that are performed when the program is run. Which change will result in a correct program with a reduced number of operations performed?
Select one:
a. Interchanging line 1 and line 2
b. Interchanging line 5 and line 6
c. Interchanging line 6 and line 7
d. lnterchanging line 7 and line 8

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
The "instance" relationship shows that something is an object of a
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Font size, font style, and are all aspects of character formatting.
Answers: 2
question
Computers and Technology, 23.06.2019 15:10
What role did women fill during world war ii?
Answers: 1
You know the right answer?
A programmer wrote the code segment below to display the average of all the elements in a list calle...
Questions
question
Social Studies, 20.12.2020 19:50
question
Spanish, 20.12.2020 19:50