Python Essentials 1:
Python Essentials 2:
Python Essentials - Final Test:
Warning!
For searching questions, CTRL+F .if you want correct answer.. type manually.Don't Copy & paste questions in search space.
If you copy paste questions in search options means.. you can't find answer
Knowing that a function named
fun()resides in a module namedmod, choose the correct way to import it:from mod import funimport fun from modfrom fun import modimport 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
1211, 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
pipusing its command named:depsshowdirlist
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))
01FalseTrue
The
piplistcommand presents a list of:- available pip commands
- outdated local package
- locally installed package
- all packages available at PyPI
How to use
pipto remove an installed package?pip --uninstall packagepip remove packagepip install --uninstall packagepip uninstall package
The following statement
from a.b import ccauses the import of:
- entity
afrom modulebfrom packagec - entity
cfrom moduleafrom packageb - entity
bfrom moduleafrom packagec - entity
cfrom modulebfrom 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 searchcommand? (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
versionfunction from theplatformmodule returns a string with your Python version - The
processorfunction from theplatformmodule returns an integer with the number of processes currently running in your OS - The
versionfunction from theplatformmodule returns a string with your OS version - The
systemfunction from theplatformmodule returns a string with your OS name
- The
What is true about the
pip installcommand? (Select two answers)- it allows the user to install a specific version of the package
- it installs a package system-wide only when the
--systemoption is specified - it installs a package per user only when the
--useroption 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 modChoose 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
reinstallcommand - it’s performed by the
installcommand accompanied by the-Uoption
Python Essentials 1:
Python Essentials 2:
Python Essentials - Final Test:
