Python Programming MCQ - Function

11. Which of the following will print the pi value defined in math module?

A. print(pi)
B. print(math.pi)
C. from math import pi
print(pi)
D. from math import pi
print(math.pi)

View Answer


12.  Which operator is used in Python to import modules from packages?

A. .
B. *
C. ->
D. &

View Answer


13. Where is function defined?

A. Module
B. class
C. Another Function
D. All of the above

View Answer


14. Lambda is a function in python?

A. True
B. False
C. Lambda is a function in python but user can not use it.
D. None of the above

View Answer


15. What is a variable defined outside a function referred to as?

A. local variable
B. global variable
C. static Variable
D. automatic variable

View Answer


16. What is the output of the following program?

z = lambda x : x * x
print(z(6))

A. 6
B. 36
C. 0
D. error

View Answer


17. What is the output of the following program?

print(chr(ord(chr(97))))

A. a
B. A
C. 97
D. error

View Answer


18. Choose the correct option with reference to below Python code?

def fn(a):
print(a)
x=90
fn(x)

A. x is the formal argument.
B. a is the actual argument.
C. fn(x) is the function signature.
D. x is the actual argument.

View Answer


19. Which one of the following is incorrect?

A. The variables used inside function are called local variables.
B. The local variables of a particular function can be used inside other functions, but these cannot be used in global space
C. The variables used outside function are called global variables
D. In order to change the value of global variable inside function, keyword global is used.

View Answer







Also check :


Discussion


* You must be logged in to add comment.