Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 97

You are asked to create a method that accepts an array of integers and returns the highest value from that array.

Given the code fragment:

Which method signature do you use at line n1?

    Correct Answer: B

    The correct method signature should be 'static int[] findMax(int[] max)' because based on the return statement in the provided code fragment, the method is supposed to return an array of integers. The suggested answer 'static int findMax(int[] numbers)' implies returning a single integer, which does not match the return type expected in the code fragment. Therefore, the correct signature is the one that returns an integer array.

Discussion
praroopguptaOption: B

Answer should be B as we want int array as response.

baledevitOption: B

Correct answer is B!

dsmsOption: C

The answer is C: static int findMax (int[] numbers)

iSnoverOption: B

Correct is Letter B because we want int array as response and I tested.

7df49fbOption: C

Don't be confused !! method : access modifier optional specifier return type methode name (parameters) static int findMax(int[]) static : because, the method is used directly in a static main method (the method exist alone without instanciating the class Test) int : return type, we want just the maximum int value from the array int[]: the method takes an array of int.

DarGrinOption: B

Answer is B

IbrahimAlnutayfiOption: B

The answer is B

KolodetsOption: C

Judging by question, we need single value so I would take C. But in the code array is returned (strangely), so B

CreazyyyyGirlOption: B

Correct answer is : B

Annie432Option: B

Return type is int[]