Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 36 Assuming that the following function exists within a module to be im

ID: 3707973 • Letter: Q

Question

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 function’s 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

a)

the client should print this function’s 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.

Explanation / Answer

47) True

sometimes the error is thrown from other function is not clear. That error has to be handled

46) True

Python contains standard exception class

38)False

python functions help achieve encapsulation

37) True

The function main role is to achieve modularity and code division so that particular function can be reused.

36)C

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote