Search Header Logo

Random Class Practice

Authored by Jessica Guthrie

Computers

9th - 12th Grade

Used 3+ times

Random Class Practice
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following lines of code will generate a random number

between 0 and 60?

Assume rand is the Random number generator

rand.nextInt(60)

rand.nextInt(61)

rand.nextInt(0, 60)

rand.nextInt(59)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What range of numbers will be included in the following Random number generator?

rand.nextInt(20)

0 to 20

1 to 20

0 to 19

20 to 100

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What range of numbers will be included in the following code?

rand.nextInt(35) + 2

2 to 35

2 to 37

2 to 36

0 to 36

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which line of code needs to go at the top so that the program can generate random numbers?

import Random Class

import java.util.Random

import java.Random

import JavaRandomClass

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the variable for the following Random number generator?

Random r = new Random();

Random

r

Random()

new

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Fill in the blank so that numbers between 0 and 500 are generated.

Random r = new Random();

int num = r.nextInt( ______ )

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?