Functions and Modules in Python

Test how well you can structure and reuse Python code.

1. What keyword is used to define a function in Python?
2. Which parameter type allows a function to accept an arbitrary number of positional arguments?
3. What value does a Python function return if it has no explicit return statement?
4. What is the scope of a variable defined inside a function?
5. Which standard library module provides the sqrt() function for square roots?
6. Which of the following are valid ways to import a module in Python? (Select all that apply)
7. Which of the following are valid parameter types in a Python function definition? (Select all that apply)
8. How can a global variable be modified inside a Python function? (Select all that apply)
9. Which are characteristics of a lambda function in Python? (Select all that apply)
10. A Python function can contain multiple return statements.
11. The __name__ variable of a module is set to '__main__' when the module is imported into another script.
12. Default parameters in Python are evaluated once when the function is defined, not each time the function is called.
13. What keyword is used to define a function in Python? (lowercase, single word)
14. What is the standard file extension for a Python module? (include the dot)
15. What is the output of this code: def greet(name='Guest'): return f'Hello {name}'; greet() (enter the text exactly)
Answered 0 of 0 — 0 correct