Worksheets8525 AQA GCSE 3.2.9 Random number generation
Total questions: 10
Worksheet time: 5mins
What possible values could be output by
random.randrange(6)
0,1,2,3,4,5,6
1,2,3,4,5,6
0,1,2,3,4,5
1,2,3,4,5
What possible values could be output by
random.randint(3,8)
4,5,6,7
3,4,5,6,7
3,4,5,6,7,8
0,1,2,3,4,5,6,7,8
random.uniform() requires two parameters
True
False
random.random() generates a floating point number between _____ and ______
1 and 2
1 and 0
0 and 1
0 and 10
Which function truncates the fractional part of a given number and returns only the integer or whole part?
int()
round()
real()
fraction()
Which operator is used in python to import all modules from packages?
the / operator
the * operator
the & operator
the + operator
Which of the following would generate a random number?
number =random.rand(0,100)
number=random.int(0,100)
number=random.randint(0,100)
number=random(0,100)
in "import random" what is 'random' ?
function
module
external function
importable element
This program will produce
a random number between 10 and 100 (including 10 but not 100) in increments of 10
a random number between 10 and 100 (including 10 and 100) in increments of 10
10 random numbers between 10 and 100 (including 10 and 100)
10 random numbers between 10 and 100 (including 10 but not 100)
What is this code equivalent to?
(choose two)
random.randint(1,11)
random.randint(1,10)
random.randrange(1,11,1)
random.randrange(1,10,1)
