Search Header Logo

Code 04 Random Numbers

Authored by Tod Elford

Computers

9th Grade

Code 04 Random Numbers
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

Which block is used to generate random numbers in your programs?

randomNumber()

generateRandom()

randomValue()

numberRandom()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What does the command randomNumber(1, 6) do?

Generates a random number between 1 and 6

Generates a random number between 0 and 5

Generates a random number between 1 and 5

Generates a random number between 0 and 6

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can random numbers be used in drawing commands?

As parameters to create random drawings

Only to set the color of shapes

Only to set the size of shapes

Only to set the border of shapes

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If you use randomNumber() multiple times in your program, what happens?

It generates new random numbers every time

It generates the same number every time

It generates numbers in a fixed sequence

It generates only one random number

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following best describes the use of randomNumber() in the command ellipse(randomNumber(0,400), 200);?

The x-coordinate of the ellipse is randomly chosen between 0 and 400

The y-coordinate of the ellipse is randomly chosen between 0 and 400

The size of the ellipse is randomly chosen between 0 and 400

The color of the ellipse is randomly chosen between 0 and 400

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why might each run of the command ellipse(randomNumber(0,400), randomNumber(0,400)); produce different results?

Because both coordinates are randomly generated each time

Because the color changes each time

Because the program uses a fixed sequence

Because the ellipse size is fixed

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of setting minimum and maximum values in randomNumber()?

To control the range of possible random numbers generated

To set the color of the random number

To fix the output to a single value

To repeat the same number every time

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?