Modules and Packages – Multiple Choice Questions (MCQs)
-
-
26. How do you install all the dependencies listed in a `requirements.txt` file?
-
27. What is the output of `import sys; print(sys.path)`?
-
28. What is the first directory listed in `sys.path` typically?
-
29. What is the purpose of the `if __name__ == '__main__':` block in a Python module?
-
30. If you run a Python file `my_script.py`, what will be the value of `__name__` within that script?
-
31. If you import `my_script.py` into another file, what will be the value of `__name__` within `my_script.py`?
-
32. What is the purpose of relative imports in Python packages?
-
33. Which syntax is used for relative imports within a package?
-
34. What does `from . import module_a` mean when used in a package?
-
35. What does `from .. import package_b` mean when used in a sub-package?
-
36. What is the purpose of the `__all__` variable in a Python module?