wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Modules, Packages, and Libraries

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A Python file that contains variables and functions and can be used in other programs is called a _________________.

a)

class

b)

documentation

c)

dictionary

d)

module

2.

A collection of modules and packages that can be imported into a program is called a __________.

a)

class

b)

documentation

c)

library

d)

function

3.

How could you use the sqrt function from the math module to print the square root of 16?

a)

import sqrt print(math.sqrt(16))

b)

from math import sqrt print(math.sqrt(16))

c)

from math import sqrt print(sqrt(16))

d)

import sqrt print(sqrt(16))

4.

What is pseudocode?

a)

Variable

b)

A way to represent algorithms using encrypted code

c)

Constant

d)

A way to represent algorithms using written language

5.

__________ keyword is used for creating a function in Python.

a)

define

b)

fun

c)

def

d)

function

6.

Which loop do you use to repeat only 5 times?

a)

IF loop

b)

FOR loop

c)

Never ending loop

d)

Selection loop

7.

The code below is a function call. What is inside the brackets "( )"?

a)

A parameter

b)

Literal

c)

An IF statement

d)

Function

8.

What is the extension of python library modules?

a)

.mod

b)

.lib

c)

.code

d)

.py

9.

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

10.

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