wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Libraries - Random Numbers

Total questions: 10

Worksheet time: 2mins

Name
Class
Date
1.

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

a)

. operator

b)

* operator

c)

-> symbol

d)

, operator

2.

What is the extension of python library modules?

a)

.mod

b)

.lib

c)

.code

d)

.py

3.

(a)   which function helps to display all information including docstring ,function name and constant in a module.

4.

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

5.

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

6.

random.uniform() requires two parameters

a)

True

b)

False

7.

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

8.

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

a)

int()

b)

round()

c)

oct()

d)

hex()

9.

docstrings

a)

single quoted comments

b)

double quoted comments

c)

triple quoted comments

d)

hash tagged comments

10.

cmath module provides

a)

mathematical functions to support different types of calculations

b)

mathematical statistics functions

c)

pseudo random numbers

d)

mathematical functions for complex numbers