PE2 - Module 1 Test

Ace your homework & exams now with Quizwiz!

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

show

The digraph written as #! is used to:

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

A function which returns a list of all entities available in a module is called:

dir()

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

1

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

11, 12, 21, or 22

Choose the true statements. (Select two answers)

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

A predefined Python variable that stores the current module name is called:

__name__

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

__pycache__

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

When a module is imported, its contents:

are executed once (implicitly)

The pyc file contains:

compiled Python code

The following statement from a.b import c causes the import of:

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

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 per user only when the --user option is specified

What is true about updating already installed Python packages?

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

The pip list command presents a list of:

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

How to use pip to remove an installed package?

pip uninstall package


Related study sets

Microsoft Office Specialist - Office 2016

View Set

dh32, ch. 2 Properties of Materials

View Set

UNCW SABA 379 FINAL EXAM Spring 2019

View Set

BSC 227 Strait Chapter 3 Histology part 2

View Set

Chapter 33 Post-Class Assignment Part II: Aggregate Demand and Aggregate Supply

View Set

ASE A1 - Practice Test (Section E) Documen term 2 set 8

View Set

MIS 160 Chapter 4 Homework questions

View Set

Chapter 10 - Misleading Graphs & Statistics

View Set