Which of the following is the correct code snippet for throwing a pair of dice to get a sum of the numbers on two dice between 2 and 12 with different probabilities? (Assume Random generator = new Random() ;)
A) int sum = generator.nextInt(6) + generator.nextInt(6) + 2
B) int sum = generator.nextInt(12) + 1
C) int sum = generator.nextInt(6 + 1) + generator.nextInt(6 + 1)
D) int sum = generator.nextInt(11) + 2
Correct Answer:
Verified
Q118: What will be the output of the
Q119: What is the last output line of
Q120: What is the output of this code
Q121: Suppose that the chance to hit the
Q122: What does the following code snippet display?
Q124: How many times does the following loop
Q125: Which of the following code snippets will
Q126: Which of the following is correct for
Q127: What does the following code do?
Int sum
Q128: What is the data type of the
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents