Search Header Logo

Java Random Output Quiz

Authored by Jeanette Patterson

Computers

11th Grade

Used 2+ times

Java Random Output Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( Math.random() * 3 );

A random double value between 0.0 and 3.0

A random integer value between 0 and 3

A constant value of 1.5

A random double value between 1.0 and 4.0

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( (int)(Math.random()*5) + 3 );

An integer value between 3 and 7

An integer value between 0 and 5

An integer value between 1 and 6

An integer value between 2 and 8

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( (int)Math.random()*4 + 5 );

5

6

7

8

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( Math.abs( -5.2 ) );

5.2

-5.2

0

5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( (int)(Math.random()*5) + 3 );

3, 4, 5, 6, 7

0, 1, 2, 3, 4

5, 6, 7, 8, 9

1, 2, 3, 4, 5

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( (int)(Math.random()*50) );

A random integer between 0 and 49

A random integer between 1 and 50

A random integer between 0 and 50

A random integer between 1 and 49

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What value(s) will be output by the following Java code statement? System.out.println( Math.abs( 6 ) );

6

-6

0

Error

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?