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
The Internet has made it possible for most people to order all of their clothing online. While this may be a preference for some
suter [353]

Answer:

Explanation:

Based on the information provided in this scenario it can be said that this is likely due to there being a cultural lag between having the Internet and using the technology to its full capacity. Cultural lag refers to the notion that culture takes time to catch up with technological innovations, mainly due to not everyone has access to the new technology. As years pass a specific technological advancement becomes more readily accessible to the wider public as is thus more widely adopted.

3 0
3 years ago
_____ is a predefined format used for text the can include multiple font formatting features
seraphim [82]
The correct answer is



style
8 0
3 years ago
A device capable of copying a graphic, document, or other object is called a
Amiraneli [1.4K]
A printing press or printer
5 0
3 years ago
Read 2 more answers
Alexi is writing a program which prompts users to enter their race times without decimals. Which function should she use?
Juli2301 [7.4K]

Answer:

It's either B or C

Explanation:

I saw this on another brainly but they said it wasn't print so id say b is most likely

6 0
2 years ago
Read 2 more answers
Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter a value. the program divi
neonofarm [45]

Pseudocode

<span> Start <span> input myNumber <span> set myAnswer = myNumber / 2 output myAnswer <span> stop <span>Pseudocode is a computer programming language that resembles plain English and compiled or process into the computer. It explains the solution of the problem. Sometimes used as a detailed step by step process in developing a program</span></span></span></span></span>
8 0
2 years ago
Other questions:
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • ICT excel data homework
    10·1 answer
  • Is the answer a,b,c,d
    8·1 answer
  • Which of the following is a default letter assigned for the primary hard drive
    6·2 answers
  • What are the cues that a website is safe to use for exchanging sensitive information?
    10·1 answer
  • What is the binary system?
    13·2 answers
  • What goals do you set for yourself while studying?
    9·2 answers
  • Which of the following statements is FALSE?
    5·1 answer
  • Why I/O modules is needed between system bus<br>and I/O devices?​
    15·1 answer
  • Match the TCP/IP Layer to a problem that can happen there.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!