Python Programming MCQ - Function

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


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

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

View Answer


11. Where is function defined?

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

View Answer


12. Lambda is a function in python?

A. True
B. False

View Answer


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


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


15. What is the output of the following program?
print(chr(ord(chr(97))))

A. a
B. A
C. 97
D. Error

View Answer







Also check :


Discussion


* You must be logged in to add comment.