WORKSHEET
CLASS 11
COMPUTER SCIENCE
PREPARED BY: ANKIT PRABHAKAR
CHAPTER-8 PYTHON MODULES
CASE BASED MCQ’s
1. A Python module is a file containing Python definitions and statements. A module can define functions, classes and
variables. A module can also include run able code. Grouping related code into a module makes the code easier to
understand and use. It also makes the code logically organized.
When you import a module, the Python interpreter searches for the module in the following sequences.
a. The current directory.
b. If the module isn't found, Python then searches each directory in the shell variable PYTHONPATH.
c. If all else fails Python checks the default path. On UNIX, this default path is normally/usr/local/lib/ python/
i. To import multiple objects, which symbol is used to write multiple objects?
(a) # (b) : (c) ; (d) ,
ii. Which of the following module is used in Python?
(a) math (b) pie (c) statistics (d) square root
iii. Which keyword is used to import the module?
(a) import (b) import_module (c) module (d) None of the above
iv. Which of the following module is used for mean(). mode () and median?
(a) math (b) arithmetic (c) statistics (d) random
v. Choose the correct syntax to import all objects of a module.
(a) from module_name import * (b) from module_name import all
(c) module_name from import (d) all module from import
2. Define the sqrt() method with example?
3. What is return by the following code?
i. [Link](8.7) ii. [Link](9.5)
4. What will be the output of the given code?
import random
[Link](1,50,10)