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, 22.06.2019 23:30
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
If i uninstall nba 2k 19 from my ps4 will my career be gone forever?
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject after the midsemester exams and the end-of-semester exams. she divides the midsemester and end-of-semester information into two separate worksheets, sheet 1 and sheet 2. how will she rename the two worksheets?
Answers: 2
You know the right answer?
Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
Questions
question
Mathematics, 27.05.2021 18:00
question
Mathematics, 27.05.2021 18:00
question
Mathematics, 27.05.2021 18:00
question
Mathematics, 27.05.2021 18:00
Questions on the website: 13722362