WorksheetsRandom functions
Total questions: 10
Worksheet time: 5mins
To include the use of functions which are present in the random library, we must use the option:
import random
random.h
import.random
random.random
The output of the above Python code is either 1 or 2.
True
False
error
What will be the output of the above Python code?
An integer other than 2, 3 and 4
Either 2,3 or 4
Error
3 only
What will be the output of above given code
Error
Either 10.4, 56.99 or 76
Any number other than 10.4, 56.99 and 76
56.99 only
What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')
sun
u
either s,u or n
error
What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)
error
either 3 or 4
Any integer other than 3 and 4
Any decimal value between 3 and 4
What will be the output of the following Python function if the random module has already been imported?
random.randint(3.5,7)
Error
Any integer between 3.5 and 7, including 7
Any integer between 3.5 and 7, excluding 7
The integer closest to the mean of 3.5 and 7
randint() takes (a) arguments
randrange() takes only integer values
True
False
What will be the output of the following Python code?
random.randrange(1,100,10)
32
67
91
80
