Question: 1)Given the following method Given int[] num = {111, 77, 222}, what are the correct statements to complete the following method (int min) that returns

1)Given the following method Given int[] num = {111, 77, 222}, what are the correct statements to complete the following method (int min) that returns the smallest value in the array?

public static int min(int[] arr) {

int smallest = arr[0];

for (int i = 1; i < arr.length; i++) {

____________________________________

____________________________________

}

}

return smallest;

}

Select one:

A.if (arr[1] < smallest)

smallest = arr[1];

B.if (arr[i] > smallest)

smallest = arr[i]

C.if (arr[i] < smallest)

smallest = arr[i]

D.if (arr[0] < smallest)

smallest = arr[0];

2)(void printingSize), what will be the output of this program fragment?

static void printingSize(){

int[] value1 = {31, 22, 25};

int[] value2 = {3, 2};

value1 = value2;

System.out.print(value1.length);

System.out.print(value1[1]);

System.out.println(value2[1]);

}

Select one:

A.322

B.3222

C.222

D.2222

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!