Explore topic-wise MCQs in Java.

This section includes 9 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the signature of Math.random() method?

A. public static double random()
B. public void double random()
C. public static int random()
D. public void int random()
Answer» B. public void double random()
2.

Math.random() guarantees uniqueness?

A. True
B. False
Answer» C.
3.

How many bits are used for generating random numbers?

A. 32
B. 64
C. 48
D. 8
Answer» D. 8
4.

What is the range of numbers returned by Math.random() method?

A. -1.0 to 1.0
B. -1 to 1
C. 0 to 100
D. 0.0 to 1.0
Answer» E.
5.

What is the return type of Math.random() method?

A. Integer
B. Double
C. String
D. Boolean
Answer» C. String
6.

Which method is used to generate boolean random values in java?

A. nextBoolean()
B. randomBoolean()
C. previousBoolean()
D. generateBoolean()
Answer» B. randomBoolean()
7.

Which class is used to generate random number?

A. java.lang.Object
B. java.util.randomNumber
C. java.util.Random
D. java.util.Object
Answer» D. java.util.Object
8.

RANDOM_NUMBER_BETWEEN_4_TO_7,_INCLUDING_4_AND_7?$

A. Random number between 4 to 7, excluding 4 and 7
B. Random number between 4 to 10, excluding 4 and 10
C. Random number between 4 to 10, including 4 and 10
Answer» B. Random number between 4 to 10, excluding 4 and 10
9.

Random is a final class?

A. True
B. False
Answer» C.