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 11:00
What are two of the most common reasons that peolpe who need mental health care do not access it?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
Answers: 1
question
Computers and Technology, 25.06.2019 03:30
Kou converged his word document to a powerpoint document. when he received the powerpoint, he was missing material. which most likely explains why the material was missing? a it did not have a proper heading b he incorrectly copied and pasted it c he did not save his document properly d there was not enough space in powerpoint
Answers: 1
You know the right answer?
Assume that you have an array of integers named arr.
the following program segment is intende...
Questions
question
Mathematics, 07.04.2021 04:20
question
Computers and Technology, 07.04.2021 04:20
Questions on the website: 13722361