Python Function Set-1

Instruction:-

  • Number of Questions : 25
  • Total Marks : 25
  • Each question carry 1 Marks.
  • No negative marking

  •  

    Results

    #1. What is the correct syntax to define a function in Python?

    #2. Which keyword is used to return a value from a function?

    #3. What is the output of the following?
    def add(x, y):
    return x + y
    print(add(2, 3))

    #4. What will be the output?
    def greet():
    print(“Hello”)
    greet()

    #5. Which of the following is a built-in function?

    #6. A function can return multiple values using:

    #7. What is the output of this?
    def test():
    return
    print(test())

    #8. Which of the following can be passed to a function?

    #9. What is a function that calls itself called?

    #10. In Python, functions must always have a return statement.

    #11. What is the output?
    def myfunc(a=2, b=3):
    return a * b
    print(myfunc(4))

    #12. What type of error is this?
    def myfunc()
    print(“Hello”)

    #13. Which function is used to get user input?

    #14. What does the len() function do?

    #15. What is the correct way to call a function named display?

    #16. Which keyword is used to define a function?

    #17. A function without a return statement returns:

    #18. What is the output?
    def show():
    print(“Hi”)
    x = show()
    print(x)

    #19. What is the output?
    def square(x):
    return x * x
    print(square(3))

    #20. Functions help to:

    #21. What is a parameter?

    #22. Arguments are:

    #23. A function inside another function is called:

    #24. How do you comment in Python?

    #25. What will this code print?
    def add(x, y=5):
    return x + y
    print(add(3))

    Previous
    Finish

    Leave a Comment

    Your email address will not be published. Required fields are marked *