Solved

Consider the Following Code Snippet

Question 99

Multiple Choice

Consider the following code snippet. What does the array contain at the end of the program?
Public static fillWithRandomNumbers(double[] values)
{
Double[] numbers = new double[values.length];
For (int i = 0; i < numbers.length; i++)
{
Numbers[i] = Math.random() ;
}
Values = numbers;
}
Public static void main(String[] args)
{
Double[] num = new double[20];
FillWithRandomNumbers(num) ;
}


A) 20 random numbers
B) Undefined data due to compilation error
C) 20 zeros because array num is not changed by method
D) Array index bound error

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