Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP module

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is a library in python?

a)

Collection of files

b)

Collection of Modules

c)

It is Subprogram

d)

Name of a file

2.

What will be the output of the following

from import factorial

print(math.factorial(5))

a)

25

b)

10

c)

120

d)

error bcz factorial is not a module in math

3.
Which of these definitions correctly describes a module?
a)
a) Denoted by triple quotes for providing the specification of certain program elements
b)
b) Design and implementation of specific functionality to be incorporated into a program
c)
c) Defines the specification of how it is to be used
d)
d) Any program that reuses code
4.

Which of the statements is used to import all names from a module into the current calling module

a)

import

b)

from

c)

dir()

d)

import*

5.
______ is a string literal denoted by triple quotes for providing the specifications of certain program elements.
a)
a) Interface
b)
b) Modularity
c)
c) Client
d)
d) Docstring
6.
A Python module is a file with the _____ file extension that contains valid Python code.
a)
.pymodule
b)
.py
c)
.module
d)
.pym
7.

Name the keyword used to define a function.

a)

define

b)

def

c)

function

d)

fu

8.

Which one is not true about function?

a)

It breaks the large program into small modules.

b)

It avoids repetition.

c)

It makes code reusable.

d)

It makes the program unorganized.

9.

What will be the output of the following Python code?

def cube(x):

return x * x * x


x = cube(3)

print (x)

a)

9

b)

3

c)

27

d)

30

10.

What are the two main types of functions?

a)

Custom function

b)

Built-in function & User defined function

c)

User function

d)

System function