PE2 Module 1 Test (Packages)

¡Supera tus tareas y exámenes ahora con Quizwiz!

A function which returns a list of all entities available in a module is called: entities() content() dir() listmodule()

dir()

A list of package's dependencies can be obtained from pip using its command named: deps show dir list

show

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

1

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

tell a Unix or Unix-like OS how to execute the contents of a Python file

A predefined Python variable that stores the current module name is called: __name__ __mod__ __modname__ __module__

__name__

During the first import of a module, Python deploys the pyc files in the directory called: mymodules __init__ hashbang __pycache__

__pycache__

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

11, 12, 21, or 22

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

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

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

all its searches are limited to locally installed packages it needs working internet connection to work it searches through all PyPI packages

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)

are executed once (implicitly)

The pyc file contains: a Python interpreter compiled Python code Python source code a Python compiler

compiled Python code

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

entity c from module b from package a

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

from mod import fun

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

it allows the user to install a specific version of the package it installs a package per user only when the --user option is specified

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

it's performed by the install command accompanied by the -U option

The pip list command presents a list of: available pip commands outdated local package locally installed package all packages available at PyPI

locally installed package

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()

mod.fun()

How to use pipto remove an installed package? pip --uninstall package pip remove package pip install --uninstall package pip uninstall package

pip uninstall package


Conjuntos de estudio relacionados

LD 35 - Firearms and Chemical Agents

View Set

Business Law Exam 1 Review Question Batch Questions ch. 6-10

View Set

Biology Practice Exam 1 (Ch.22-25)

View Set

GOVT 2305: UNIT 1 Smartbook CH 11

View Set

Abnormal Psychology Exam 4 Module 10

View Set

AP World History (AP Classroom) Questions U7

View Set

Anatomy respiration III - Pleurae, lungs and tracheobronchial tree

View Set