Lesson 5: Functions and Modules in Python

MCQ Paper

1. How do you define a function in Python?





2. What is the return type of a function that does not return anything?





3. How do you call a function named greet?





4. What is the output of this code?

      def add(a, b=5):
       return a+b
      print(add(3))




5. How do you import an entire module in Python?





6. What is a built-in Python function?





7. What will be the output of the following function?

      def multiply(x, y):
       print(x * y)
      multiply(3 , 4)




8. What is the purpose of return in a function?





9. What will math.sqrt(16) return?





10. How do you import only the sqrt function from the math module?





Wait for 30 seconds...

Post a Comment

Previous Post Next Post