wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Libraries

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

This program will produce

a)

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

b)

a random number between 10 and 100 (including 10 and 100) always 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 and not 100)

2.

This code is equivalent to

a)

random.randint(1,11)

b)

random.randint(1,10)

c)

random.randrange(1,11,1)

d)

random.randrange(1,10,1)

3.

Which file must be part of the folder containing python module files to make it importable python package?

a)

init.py

b)

_setup_.py

c)

_init_.py

d)

setup.py

4.

What does this expression result in

a)

32

b)

64

c)

16

d)

128

5.

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

a)

. operator

b)

* operator

c)

-> symbol

d)

, operator

6.

What is the extension of python library modules?

a)

.mod

b)

.lib

c)

.code

d)

.py

7.

How do you tell python you want to use the turtle library

a)

turtle import

b)

import turtle

c)

from libraries import turtle

d)

from turtle import libraries

8.

Which of these commands would successfully create a turtle named Alice

a)

Alice = turtle.turtle()

b)

Alice = Turtle.turtle()

c)

Alice = Turtle.Turtle()

d)

Alice = turtle.Turtle()

9.

In python which is the correct method to load a module math?

a)

include math

b)

import math

c)

#include<math.h>

d)

using math