Learn Without Walls
← Back to Module 9

Module 9 Quiz

Functions — 12 Questions

1. Which keyword is used to define a function in Python?

2. What happens if you write my_func without parentheses?

3. What is a docstring?

4. What does a function return if it has no return statement?

5. What is the output of this code?

def add(a, b=10):
    return a + b

print(add(5))

6. What is the difference between a parameter and an argument?

7. What does *args collect?

8. What does **kwargs collect?

9. What is the output of this code?

x = 100

def change():
    x = 200

change()
print(x)

10. Which keyword allows a function to modify a global variable?

11. What does this function return?

def get_info():
    return "Alice", 25

12. What is the LEGB rule?

Back to Module 9