wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

8525 AQA GCSE 3.2.9 Random number generation

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What possible values could be output by


random.randrange(6)

a)

0,1,2,3,4,5,6

b)

1,2,3,4,5,6

c)

0,1,2,3,4,5

d)

1,2,3,4,5

2.

What possible values could be output by


random.randint(3,8)

a)

4,5,6,7

b)

3,4,5,6,7

c)

3,4,5,6,7,8

d)

0,1,2,3,4,5,6,7,8

3.

random.uniform() requires two parameters

a)

True

b)

False

4.

random.random() generates a floating point number between _____ and ______

a)

1 and 2

b)

1 and 0

c)

0 and 1

d)

0 and 10

5.

Which function truncates the fractional part of a given number and returns only the integer or whole part?

a)

int()

b)

round()

c)

real()

d)

fraction()

6.

Which operator is used in python to import all modules from packages?

a)

the / operator

b)

the * operator

c)

the & operator

d)

the + operator

7.

Which of the following would generate a random number?

a)

number =random.rand(0,100)

b)

number=random.int(0,100)

c)

number=random.randint(0,100)

d)

number=random(0,100)

8.

in "import random" what is 'random' ?

a)

function

b)

module

c)

external function

d)

importable element

9.

This program will produce

a)

a random number between 10 and 100 (including 10 but not 100) in increments of 10

b)

a random number between 10 and 100 (including 10 and 100) in increments of 10

c)

10 random numbers between 10 and 100 (including 10 and 100)

d)

10 random numbers between 10 and 100 (including 10 but not 100)

10.

What is this code equivalent to?

(choose two)

a)

random.randint(1,11)

b)

random.randint(1,10)

c)

random.randrange(1,11,1)

d)

random.randrange(1,10,1)