Solved

What Does the Following Code Do

Question 127

Multiple Choice

What does the following code do?
Int sum = 0;
Final double count = 1000;
Random generator = new Random() ;
For (int i = 1; i <= count; i++)
{
Sum = sum + generator.nextInt(101) ;
}
System.out.println(sum / count) ;


A) It simulates the outcome of throwing a coin.
B) It calculates the average of 1000 random numbers between 0 and 100.
C) It performs Monte Carlo simulation of fluid dynamics.
D) It calculates the average of 1000 random numbers between 1 and 101.

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