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.
-
Knowing that a function named
fun()
resides in a module namedmod
, choose the correct way to import it:from mod import fun
import fun from mod
from fun import mod
import fun
-
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
-
During the first import of a module, Python deploys the pyc files in the directory called:
mymodules
__init__
hashbang
__pycache__
-
A list of package’s dependencies can be obtained from
pip
using its command named:deps
show
dir
list
-
What is the expected value of the result variable after the following code is executed?
import math result = math.e != math.pow(2, 4) print(int(result))
0
1
False
True
-
The
pip
list
command presents a list of:- available pip commands
- outdated local package
- locally installed package
- all packages available at PyPI
-
How to use
pip
to remove an installed package?pip --uninstall package
pip remove package
pip install --uninstall package
pip uninstall package
-
The following statement
from a.b import c
causes the import of:
- entity
a
from moduleb
from packagec
- entity
c
from modulea
from packageb
- entity
b
from modulea
from packagec
- entity
c
from moduleb
from packagea
- entity
-
The pyc file contains:
- a Python interpreter
- compiled Python code
- Python source code
- a Python compiler
-
A predefined Python variable that stores the current module name is called:
__name__
__mod__
__modname__
__module__
-
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
-
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)
-
Choose the true statements. (Select two answers)
- The
version
function from theplatform
module returns a string with your Python version - The
processor
function from theplatform
module returns an integer with the number of processes currently running in your OS - The
version
function from theplatform
module returns a string with your OS version - The
system
function from theplatform
module returns a string with your OS name
- The
-
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
-
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()
mod.fun()
fun()
-
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
-
A function which returns a list of all entities available in a module is called:
entities()
content()
dir()
listmodule()
-
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
1 Comment
Oldest