subject

Assume that you have an array of integers named arr.
the following program segment is intended to sum arr [0]through arr[n−1], where n = arr. length:

sum = 0;
i = 0;
n = arr. length;
while (i ! = n)
{
i++;
sum += arr[i];
}
in order for this segment to perform as intended, which of the following modifications, if any, should be made?

a) no modification is necessary
b) sum = 0; i = 0; should be changed to sum = arr[1]; i = 1;
c) while (i ! = n) should be changed to while (i < = n)
d) sum += arr[i]; should be changed to sum += arr[i+1];
e) i++; should be interchanged with sum += arr[i];

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
You know the right answer?
Assume that you have an array of integers named arr.
the following program segment is intende...
Questions
question
Arts, 09.04.2021 08:10
question
Business, 09.04.2021 08:10
question
Chemistry, 09.04.2021 08:10