Question: Mystery after each call below, write what is output for that call - 2 pts each output String sample = this is a sample; System.out.println

Mystery
after each call below, write what is output for that call -2 pts each output
String sample="this is a sample";
System.out.println (sample.substring(2,11));
PART 4
(5pts each)10 pts
Trace the following method with each of the following arrays passed as its parameter, and
write the value it would return:
public static int mystery1(int[] list){
int x =0,y;
for (int i =1; i < list.length-1; i++){
y = list[i]- list[1];
if (y <= x){
x--;;
}
}
return x;
}
{4,2,10,15,20,8}______________
PART 5
(30 pts)
3. Write a method named find that returns the average value in an array of integers. For
example, if a variable named list refers to an array containing the values {16,12,25,
44}, the call of find (list) should return 24.25 You may assume that the array has at least
one element.
public class TestFind {
public static void main(String[] args){
int[] a1={16,12,25,44};
System.out.println(find (a1));
}
// your code goes here
}

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 Programming Questions!