Learn with Yasir

Share Your Feedback

True or False: Functions in Python

  1. A function in Python is defined using the func keyword.
    Answer: False

  2. Functions in Python can return multiple values.
    Answer: True

  3. The return statement is optional in a Python function.
    Answer: True

  4. Parameters are the actual values passed to a function when it is called.
    Answer: False (These are arguments; parameters are defined in the function header.)

  5. A function without a return statement automatically returns None.
    Answer: True

  6. Default arguments in Python must always come before non-default arguments in a function definition.
    Answer: False

  7. Functions in Python can be called before they are defined in the code.
    Answer: False

  8. The def keyword is used to define a function in Python.
    Answer: True

  9. A function can be called multiple times in a program.
    Answer: True

  10. Indentation is not required in Python function definitions.
    Answer: False

  11. A function can have both positional and keyword arguments.
    Answer: True

  12. The global keyword is used to define a function that can be accessed globally.
    Answer: False

  13. A function can modify the value of a global variable without using the global keyword.
    Answer: False

  14. The pass statement can be used as a placeholder in a function body.
    Answer: True

  15. Functions in Python can be nested inside other functions.
    Answer: True

  16. The is_even function is a built-in Python function.
    Answer: False

  17. A function can be assigned to a variable in Python.
    Answer: True

  18. The return statement can be used to exit a function early.
    Answer: True