Solved

Consider the Following Method

Question 25

Multiple Choice

Consider the following method:
Public static int mystery(int length, int n)
{
Int[] result = new int[length];
For (int i = 0; i < result.length; i++)
{
Result[i] = (int) (n * Math.random() ) ;
}
Return result;
}
Which statement is correct about the code?


A) The method works perfectly
B) The method returns a random number
C) The method return type should be changed to int[]
D) The method has a bounds error when the array size is too large

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions