Python Programming MCQ - Function

16. 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
D. from math import pi

View Answer

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

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

View Answer

18. Where is function defined?

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

View Answer

19. 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

20. 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

21. What is the output of the following program?

z = lambda x : x * x

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

View Answer

22. What is the output of the following program?


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

View Answer

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

def fn(a):

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

24. 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 :


* You must be logged in to add comment.