Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

\f

Answered: 1 week ago