Modules and Packages – Multiple Choice Questions (MCQs)
-
-
2. Which keyword is used to import a module in Python?
-
3. How do you import a module named 'math' in Python?
-
4. Once a module 'math' is imported, how do you access the square root function?
-
5. How do you import a specific function 'sqrt' from the 'math' module?
-
6. If you import `from math import sqrt`, how do you call the square root function?
-
7. How do you import all names from a module 'math'?
-
8. What is the potential drawback of using `from module import *`?
-
9. How do you import a module 'my_module' with an alias 'mm'?
-
10. If you import `import my_module as mm`, how do you access a function 'my_function' from it?
-
11. What is a package in Python?
-
12. What is the purpose of the `__init__.py` file in a Python package?