subject

Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
a[i] = a[i - 1] - a[i] + a[i + 1];
}
}
indicate in the right-hand column what values would be stored in the array after the method arraymysteryexecutes if each integer array below is passed as a parameter to it.

int[] a1 = {42, 42};
arraymystery(a1);

int[] a2 = {6, 2, 4};
arraymystery(a2);
int[] a3 = {7, 7, 3, 8, 2};
arraymystery(a3);

int[] a4 = {4, 2, 3, 1, 2, 5};
arraymystery(a4);

int[] a5 = {6, 0, -1, 3, 5, 0, -3};
arraymystery(a5);

i know the answers are:

{42, 42}

{6, 8, 4}

{7, 3, 8, 2, 2}

{4, 5, 3, 4, 7, 5}

{6, 5, 9, 11, 6, 3, -3}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 24.06.2019 03:00
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
question
Computers and Technology, 24.06.2019 10:30
Which of the following types of software is most applicable to the promotion of new products through advertising? a.databases b. spreadsheets c. web design programs d. word processing tools
Answers: 2
You know the right answer?
Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
Questions
question
Spanish, 19.08.2021 07:00
question
Mathematics, 19.08.2021 07:00
question
Mathematics, 19.08.2021 07:00
question
Law, 19.08.2021 07:00
Questions on the website: 13722363