AllInfoHub Logo

AllInfoHub – MCQ Practice

Modules and Packages – Multiple Choice Questions (MCQs)

  1. 13. If you import `from my_package import sub_module`, how do you access a function 'my_function' within 'sub_module'?

    • A. my_package.sub_module.my_function()
    • B. sub_module.my_function()
    • C. my_function()
    • D. my_package->sub_module->my_function()
  2. 14. How do you import a specific function 'my_function' from the module 'sub_module' within the package 'my_package'?

    • A. import my_package.sub_module.my_function
    • B. from my_package.sub_module import my_function
    • C. import my_function from my_package.sub_module
    • D. include my_package.sub_module.my_function
  3. 15. What is the Python Standard Library?

    • A. A collection of third-party modules
    • B. A set of built-in modules that provide common functionalities
    • C. A library for advanced mathematical computations
    • D. A tool for creating graphical user interfaces
  4. 16. Which module in the Python Standard Library is commonly used for working with dates and times?

    • A. os
    • B. sys
    • C. datetime
    • D. math
  5. 17. Which module in the Python Standard Library is commonly used for interacting with the operating system?

    • A. os
    • B. sys
    • C. datetime
    • D. math
  6. 18. Which module in the Python Standard Library provides access to system-specific parameters and functions?

    • A. os
    • B. sys
    • C. datetime
    • D. math
  7. 19. What is pip in Python?

    • A. A built-in function for package management
    • B. A package installer for Python
    • C. A standard library module for input/output
    • D. A type of Python package
  8. 20. How do you install a Python package named 'requests' using pip?

    • A. install requests
    • B. pip install requests
    • C. python -m pip install requests
    • D. get-pip requests
  9. 21. How do you uninstall a Python package named 'requests' using pip?

    • A. uninstall requests
    • B. pip uninstall requests
    • C. python -m pip uninstall requests
    • D. remove-pip requests
  10. 22. How do you list all installed packages using pip?

    • A. pip list
    • B. list pip
    • C. show pip installed
    • D. pip installed list
  11. 23. What is a virtual environment in Python?

    • A. An isolated Python environment that allows you to install packages without affecting other projects
    • B. A way to run Python code in the cloud
    • C. A tool for optimizing Python code
    • D. A specific type of Python package
  12. 24. Which module is commonly used to create virtual environments in Python?

    • A. venv
    • B. virtualenv
    • C. pyenv
    • D. conda