PE2: Python Essentials 2 – 1.5 Module 1 Test Exam Answers Full 100% 2023 2024

This is Cisco NetAcad SkillsForAll PE2: Python Essentials 2 – Module 1 Test Exam Answers Full 100% in 2023 and 2024. All answers have been verified by experts.

  1. Knowing that a function named fun() resides in a module named mod , choose the correct way to import it:

    • from mod import fun
    • import fun from mod
    • from fun import mod
    • import fun
  2. What is the expected output of the following code? 
    from random import randint
    for i in range(2):
    print (randint(1,2), end='')

    • 12, or 21
    • there are millions of possible combinations, and the exact output cannot be predicted
    • 12
    • 11, 12, 21, or 22
  3. During the first import of a module, Python deploys the pyc files in the directory called:

    • mymodules
    • __init__
    • hashbang
    • __pycache__
  4. A list of package’s dependencies can be obtained from pip using its command named:

    • deps
    • show
    • dir
    • list
  5. What is the expected value of the result variable after the following code is executed?

    import math
    result = math.e != math.pow(2, 4)
    • 0
    • 1
    • False
    • True
  6. The pip list command presents a list of:

    • available pip commands
    • outdated local package
    • locally installed package
    • all packages available at PyPI
  7. How to use pipto remove an installed package?

    • pip --uninstall package
    • pip remove package
    • pip install --uninstall package
    • pip uninstall package
  8. The following statement

    from a.b import c

    causes the import of:

    • entity a from module b from package c
    • entity c from module  a from package b
    • entity b from module a from package c
    • entity c from module b from package a
  9. The pyc file contains:

    • a Python interpreter
    • compiled Python code
    • Python source code
    • a Python compiler
  10. A predefined Python variable that stores the current module name is called:

    • __name__
    • __mod__
    • __modname__
    • __module__
  11. What is true about the pip search command? (Select three answers)

    • all its searches are limited to locally installed packages
    • it needs working internet connection to work 
    • it searches through all PyPI packages
    • it searches through package names only
  12. When a module is imported, its contents:

    • are executed once (implicitly)
    • are ignored
    • are executed as many times as they are imported
    • may be executed (explicitly)
  13. Choose the true statements. (Select two answers)

    • The version function from the platform module returns a string with your Python version
    • The processor function from the platform module returns an integer with the number of processes currently running in your OS
    • The version function from the platform module returns a string with your OS version
    • The system function from the platform module returns a string with your OS name
  14. What is true about the pip install command? (Select two answers)

    • it allows the user to install a specific version of the package
    • it installs a package system-wide only when the --system option is specified
    • it installs a package per user only when the --user option is specified
    • it always installs the newest package version and it cannot be changed
  15. Knowing that a function named fun() resides in a module named mod , and it has been imported using the following line:

    import mod

    Choose the way it can be invoked in your code:

    • mod->fun()
    • mod::fun()
    • fun()
  16. The digraph written as #! is used to:

    • tell a Unix or Unix-like OS how to execute the contents of a Python file
    • tell an MS Windows OS how to execute the contents of a Python file
    • create a docstring
    • make a particular module entity a private one
  17. A function which returns a list of all entities available in a module is called:

    • entities()
    • content()
    • dir()
    • listmodule()
  18. What is true about updating already installed Python packages?

    • it can be done only by uninstalling and installing the package once again
    • it’s an automatic process which doesn’t require any user attention
    • it can be done by reinstalling the package using the reinstall command
    • it’s performed by the install command accompanied by the -U option
5 3 votes
Article Rating
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments