1 Consider the following directory structure. A statement to import the cow module would be __________. ASCIIArt Top-level package __init__.py…

1 Consider the following directory structure. A statement to import the cow module would be __________.

ASCIIArt Top-level package

__init__.py

canvas.py

figures Subpackage for figures art

__init__.py

man.py

cow.py

buildings Subpackage for buildings art

__init__.py

barn.py

house.py

 a import figures

 b import ASCIIArt.figures.cow

 c import ASCIIArt.cow

 d import ASCII.figures.cow

2 Consider the following directory structure and the from clause below the directory structure. A statement that calls the draw() function of the imported house module would be ______________.

ASCIIArt Top-level package

__init__.py

canvas.py

figures Subpackage for figures art

__init__.py

man.py

cow.py

buildings Subpackage for buildings art

__init__.py

barn.py

house.py

from ASCIIArt.buildings.house import draw

 a draw()

 b aim()

 c shoot()

 d load()

3 Consider the following directory structure. A statement that imports the barn module directly using the ‘from’ technique of importing would be ___________.

ASCIIArt Top-level package

__init__.py

canvas.py

figures Subpackage for figures art

__init__.py

man.py

cow.py

buildings Subpackage for buildings art

__init__.py

barn.py

house.py

 a from ASCIIArt.buildings import barn

 b from ASCIIArt import barn

 c from ASCII.buildings import barn

 d from ASCIIArt.buildings import *

4 Which method is used to find a module named larch?

 a imp.get_larch()

 b imp.find_module(larch)

 c imp.reload(larch)

 d imp.load_module(larch)

5 Consider the code snippet named shapes.py. A statement that changes the output to use ‘$’ when drawing shapes. (Change the value of shapes.cr) would be __________.

cr=”#”

import shapes

def draw_square(size):

for h in range(size):

for w in range(size):

print(cr, end=”)

print() 

def draw_rect(height, width):

for h in range(height):

for w in range(width):

print(cr, end=”)

print()

 a shapes.cr = $

 b cr=”$”

 c shapes.cr=”&”

 d shapes.cr=”$”

6 A programmer using the interactive interpreter wants to use a function defined in the file tools.py. Need a statement that imports the content of tools.py into the interpreter.

 a import *

 b import larch

 c import tools

 d import os

7 A file containing Python code that is passed as input to the interpreter is called a _______?

 a larch

 b package

 c module

 d script

8 Consider the code snippet named shapes.py. A statement to call the draw_square function from the shapes module, passing an argument of 3 would be _______________.

cr=”#”

import shapes

def draw_square(size):

for h in range(size):

for w in range(size):

print(cr, end=”)

print() 

def draw_rect(height, width):

for h in range(height):

for w in range(width):

print(cr, end=”)

print()

 a draw_rect(3)

 b draw_square(3.0)

 c shapes.draw_square(3)

 d The program throws an error

9 When importing a module, the interpreter first checks to see if that module has already been imported. A dictionary of the loaded modules is stored in_______.

 a sys.libs

 b sys.larch

 c sys.modules

 d sys.packages

10 A _________ is a file containing Python code that can be imported by a script.

 a larch

 b package

 c module

 d script

homeworkhelplocal
Calculate your essay price
(550 words)

Approximate price: $22

How it Works

1

It only takes a couple of minutes to fill in your details, select the type of paper you need (essay, term paper, etc.), give us all necessary information regarding your assignment.

2

Once we receive your request, one of our customer support representatives will contact you within 24 hours with more specific information about how much it'll cost for this particular project.

3

After receiving payment confirmation via PayPal or credit card – we begin working on your detailed outline, which is based on the requirements given by yourself upon ordering.

4

Once approved, your order is complete and will be emailed directly to the email address provided before payment was made!