Table of Contents
ToggleQuestion 1
Question 661A Python module is a file with the _____ file extension that contains valid Python cod?
- .module
- .pymodule
- .pym
- .py
4. .py
Question 2
To use a module in another module, you must import it using an ________ statement.?
- include
- import
- both A and B
- none of the above
2. import
Question 3
A package is a folder containing one or more Python modules. One of the modules in a package must be called _______.?
- __package__.py
- __main__.py
- __init__.py
4. __init__.py
Question 4
Which statement is correct to import all modules from the package??
- from package import all
- from package import *
- from package include all
- from package include *
2. from package import *
Question 5
Suppose a function called add() is defined in a module called adder.py. Which of the following code snippets correctly shows how to import and use the add() function? Select all that apply.?
(A) from adder import add result = adder.add(2, 3)
(B) from adder import add result = add(2, 3)
(C) import adder result = adder.add(2, 3)
(D) import add from adder result = add(2, 3)
Both (A) and (B)(Student answer)
Both (A) and (B)(Student answer)
Question 6
To use a module in another module, you must import it using an ________ statement.?
import
Question 7
Use of packages helps —-?
- importing any modules one at a time
- importing any modules all at a time
- importing any modules, both individually and whole
- None of the modules
3. importing any modules, both individually and whole
Question 8
Choose all the staements that are applicable to packages?
- A python package is a collection of modules.
- Functions, modules and packages are interrelated
- Modules that are related to each other are mainly put in the same package.
- All the above
4. All the above
Question 9
Which are the statements applicable to itertools?
- It is used for fastest caculation
- Memory efficiency
- Itertools is an inbuilt module
4. All the above
If you find anything wrong in this Answer Key, feel free to reach us in the comment section.