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 09:40
In the lab, which of the following displayed a list of all installed services and included a description of the service, the current state, and whether the service started automatically or manually? a. the services manager b. the applications summary c. the recommended services d. list the safe services list
Answers: 2
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
The first screen you see when you open word2016 what is called?
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, 25.11.2021 14:00
Questions on the website: 13722361