Core Java Programming Course- Random Class
Interactive Video
•
Computers
•
9th - 10th Grade
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Read more
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of the Random class in Java?
To sort arrays
To generate random numbers
To perform mathematical calculations
To handle exceptions
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you generate random numbers between 0 and 1000 using the Random class?
By using nextInt(10)
By using nextInt(1000)
By using nextInt(100)
By using nextInt(10000)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the range of numbers generated by Math.random in Java?
0 to 1
0 to 100
0 to 1000
0 to 10
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why do we need to cast the result of Math.random to an integer?
Because Math.random returns a string
Because Math.random returns a boolean
Because Math.random returns a double
Because Math.random returns a character
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you generate numbers between 10,000 and 50,000 using Math.random?
Multiply by 10,000 and add 40,000
Multiply by 50,000 and add 10,000
Multiply by 40,000 and add 10,000
Multiply by 4,000 and add 10,000
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is used to generate random numbers between 0 and 1 in Java?
Random.nextDouble
Math.random
Random.nextInt
Math.sqrt
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a key difference between the Random class and Math.random method?
Math.random is slower
Random class generates numbers between 0 and 1
Random class is faster
Math.random generates numbers between 0 and 1
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade