1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AfilCa [17]
3 years ago
8

A programmer wrote the code segment below to display the average of all the elements in a list called numbers. There is always a

t least one number in the list. text... 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?
Computers and Technology
1 answer:
mestny [16]3 years ago
3 0

Answer:

Swap codes in line 7 and 8

Explanation:

The code segment below

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 above code will make the program translator calculate the average value at each iteration.

This will take a longer time to execute and also means more instructions for the program translator.

Swapping line 7 and 8 will reduce the number of instructions to execute. This will have an instant effect on the time taken to execute the program.

Swapping line 7 and 8 means that, the program translator will only calculate the average after it must have finished calculating the sum of the values in the iteration statement.

You might be interested in
Analytical processing uses multi-levelaggregates, instead of record level access.? True? False
Dominik [7]

Answer:

True.

Explanation:

Analytical processing uses multi-levelaggregates, instead of record level access.

8 0
4 years ago
What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
Vlada [557]
They are Internet search engines.
7 0
4 years ago
Which is an appropriate strategy for using a workplace blog?
OLEGan [10]

Answer:

a

Explanation:

8 0
3 years ago
The person who receives financial protection from a life insurance plan is called a:
tatiyna
The answer to this question is A. Beneficiary
Payer is the person who buy the insurance (not necessarily for themselves only, can be given to their family or friends). Insured can not only be a person, but it also can be an object (such as cars). And the giver is the company who provide the insurance service for the payer.
6 0
3 years ago
Read 2 more answers
Where was this taken
Korolek [52]

Answer:

Mostar city

Explanation:

look at the architecture

6 0
3 years ago
Read 2 more answers
Other questions:
  • Mara's presentation included essential information about the company's new safety procedures. She wanted to make
    13·2 answers
  • Which type of statement is used to communicate one’s feelings in a nonconfrontational manner?
    14·1 answer
  • How many bits must be "flipped" (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase that’s represented
    13·2 answers
  • Use of the Internet for recruiting is: a. popular with job seekers, but not recruiters. b. the most commonly used search tactic
    5·1 answer
  • VURULU<br> The default style in Word is called the
    6·1 answer
  • Write a program that prompts the user for an integer, then asks the user to enter that many values. Store these values in an arr
    14·1 answer
  • Describe how computers are used to access, retrieve, organize, process, maintain, interpret, and evaluate data and information.
    13·1 answer
  • Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a
    7·1 answer
  • If you are Rich In adopt me friend me And give me pets Please
    5·2 answers
  • Explain any two features of a computer​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!