Solved

Consider the Following Method

Question 44

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents