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
What Intel socket recommends the use of a liquid cooling system?
Komok [63]
The socket which Intel recommends that one should use with a liquid cooling system is LGA 2011. LGA 2011, also known as socket R is a CPU socket manufactured by Intel. It was released into the market in November 2011 and it replaced LGA 1366 and LGA 1567 in the performance and high end desk tops and server platforms. Socket R has 2011 pins that touch contact points on the underside of the processor.
7 0
3 years ago
You are a cleared employee. You discovered fraud and waste of money related to a classified program within your agency. If you r
Irina-Kira [14]

Answer:

A. True.

Explanation:

In this scenario, you are a cleared employee. You discovered fraud and waste of money related to a classified program within your agency. If you report this fraud and waste through appropriate channels, you may receive protection under the Presidential Policy Directive 19 (PPD-19): Protecting Whistleblowers with Access to Classified Information.

In USA, the Presidential Policy Directive 19 (PPD-19) which was signed by President Barack Obama in October 2012, is an executive order designed to provide significant protection for an employee who have access to classified informations such as fraud, waste of money and abuse or prohibiting any form of retaliation against this cleared employee.

3 0
3 years ago
Cách soạn thảo văn bản trên word
pickupchik [31]

Answer:

Did you mean How to edit text on word? There are 2 word, Microsoft Word Office and WordPad. The step I give you below is for both.

Explanation:

Steps to edit text on word

Step-1: Select the text you want to edit.

Step-2: Click on Home Tab.

Step-3: Select the style(s) you want to edit from the Font group

8 0
3 years ago
What is a number system, and what is the total number of digits used in this system called?
DENIUS [597]
The number system is what is use globally as are way of counting the total number of digits is 9 because you can make any number with characters 1-9
7 0
3 years ago
What is it called when two or more devices connect together?.
fredd [130]

Answer:

When two or more computers are connected together so they can communicate with one another, they form a network. The largest computer network in the world in the Internet.

6 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is the rarest and most valuable mineral ore among the native elements?
    13·1 answer
  • In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the
    12·1 answer
  • Complete the paragraph to explain how Angelina can notify readers that her report is just a draft. Angelina has decided to add t
    12·2 answers
  • * Declare a variablecalled "car" of type "Car", and initialise its value to a new instance of the "Car"class.
    9·1 answer
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which process should be
    14·1 answer
  • Imagine that you need to be late to work next Thursday because of a doctor's appointment. Compose your own e-mail appropriate fo
    12·1 answer
  • Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG
    8·1 answer
  • Deciding whether to explode a process further or determine that it is a functional primitive is a matter of experience, judgment
    8·1 answer
  • What tab appears that allows for charts to be formatted when a chart is selected?
    15·1 answer
  • How to edit slides into video.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!