Question: Consider the following code segment and method. int [ ] list = { 9 0 , 8 0 , 7 0 , 6 0 ,

Consider the following code segment and method.
int[] list ={90,80,70,60,50,40,30,20,10};
mystery(list);
public static void mystery(int[] x)
{
int n = x.length-1;
for(int k = n; k >=0; k--)
x[k]= x[k]/x[n];
}
Assume that integer array contains the following values: {90,80,70,60,50,40,30,20,10}
Which of the following represents the contents of list as a result of calling method mystery?
Consider the following code segment and method.
int[] list ={90,80,70,60,50,40,30,20,10};
mystery(list);
public static void mystery(int[] x)
{
int n = x.length-1;
for(int k = n; k >=0; k--)
x[k]= x[k]/x[n];
}
Assume that integer array contains the following values: {90,80,70,60,50,40,30,20,10}
Which of the following represents the contents of list as a result of calling method mystery?
{90,80,70,60,50,40,30,20,1}
An ArrayIndexOutOfBoundsException error message
{90,80,70,60,50,40,30,20,10}
{9,8,7,6,6,4,3,2,10}
{9,8,7,6,6,4,3,2,1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!