Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 31 When using the import modulename form of import, the identifiers of the imported module become part of the namespace of the importing module.

Question 31

When using the import modulename form of import, the identifiers of the imported module become part of the namespace of the importing module.

a) True

b False

Question 32

When a module is imported using the from modulename import identifier form of import, each imported identifier can be referenced without needing to be fully qualified.

True

False

Question 33

When importing a module using the from modulename import * form of import, the private identifiers of the imported module are not imported, but can still be accessed by the importing module

a) True

b False

Question 34

Which of the following is not true of main modules?

a)

main modules provide the basis for a complete Python program.

b)

main modules may import, or include, any number of other modules.

c)

main modules are given the name __main__.

d) main modules are directly executed.

e)

main modules are meant to be imported into other modules.

Question 35

The following line of code will:

from math import factorial as simpFact

a)

this is not proper Python code.

b) import only the factorial function from the math module and integrate it into the namespace of the client as simpFact instead of factorial.

c)

import only the factorial function from the math module into client, which must be fully qualified when called.

d)

make every function from the math module available in a client program, but the function factorial will be renamed to simpFact.

Question 36

Assuming that the following function exists within a module to be imported into a client, how should the client treat this function?

def largerThan(num1, num2): """ Returns the larger of two numbers """

if num1 > num2: return num1 else: return num2

a)

the client should print this functions docstring before using it

b)

this function is private, even if a client imports its module, the function cannot be accessed.

c) the client can use this function at will as long as it imported.

d)

this function is private, the client can access it but should not.

Question 37

One of the main advantages of functions is that they support divide and conquer programming.

a) True

b) False

Question 38

A Python function helps prevent encapsulation.

a) True

False

Question 46

Python contains a predefined set of exceptions called standard exceptions.

a)True

b) False

Question 47

Exceptions that are thrown by a given function must be caught by the function to gracefully handle errors.

a) True

b) False

Question 48

If an exception is thrown all the way back to the main module and not handled there, the program terminates.

a) True

b) False

What type of error are exceptions designed to catch?

b)run time

b)

syntax

c)

logic

d)

alphanumeric

Question 51

Some string methods alter the string they are called on, while others return a new altered version of the string.

a) True

b) False

Question 53

All raised standard exceptions must be handled in Python.

a) True

b) False

Question 56

The string method "isdigit" returns true if the string applied to contains any digits.

a) True

b) False

Question 57

All modular designs are a result of a top-down design process.

a) True

b) False

Question 58

When a given function is called it is said to be,

a)

activated

b)

subrogated

c)

Instantiated

d)

invoked

Question 59

String arguments may be modified within a function resulting in a changed value in the calling module.

a) True

b) False

Question 60

For a variable to be global is must be defined inside a function within the main module.

a) True

b) False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions