Question Bank – Python Functions
Part A – 2 Marks Questions
1. What is a function in Python?
2. List two advantages of using functions.
3. How is a function defined in Python?
4. What is meant by function call?
5. Differentiate between local and global variables.
6. What is the purpose of the global keyword?
7. Define scope and lifetime of a variable.
8. What is a parameter? Give an example.
9. Explain keyword arguments with an example.
10. What is a default argument?
11. What are variable-length arguments?
12. Define a lambda function with syntax.
13. What is recursion?
14. State the difference between return and print.
15. What is the LEGB rule in Python?
16. Give an example of a recursive function.
17. What does the return statement do in Python?
18. What is meant by argument and parameter?
19. Write the syntax of defining a function with parameters.
20. What is the difference between positional and keyword arguments?
Part B – 5 Marks Questions
1. Explain the need for functions in Python with examples.
2. Discuss the types of arguments supported by Python functions with examples.
3. Explain local and global variables with suitable code examples.
4. Write a note on variable scope and lifetime.
5. Explain the global statement with an example.
6. Describe the LEGB rule for variable name resolution in Python.
7. Write a Python function to find the factorial of a number using recursion.
8. Explain the use of default arguments and keyword arguments with examples.
9. Write a Python program using variable-length arguments to find the sum of given numbers.
10. Explain the concept of lambda (anonymous) functions with examples.
11. Differentiate between recursion and iteration.
12. Write a function to find the greatest common divisor (GCD) of two numbers.
13. Write a function to calculate exponents using recursion.
14. Explain how multiple values can be returned from a Python function.
15. Write a Python program to generate Fibonacci series using recursion.
Part C – 10 Marks / Long Answer Questions
1. Explain in detail the concept of functions in Python, their need, and advantages with examples.
2. Discuss various types of function arguments in Python (required, keyword, default,
variable-length) with suitable examples.
3. Explain variable scope and lifetime with an example. How does Python resolve names using the
LEGB rule?
4. Explain recursive functions with two examples – factorial and Fibonacci series.
5. Compare and contrast recursion and iteration with suitable programs.
6. Write detailed notes on: Local and global variables, Global statement, Return statement.
7. Discuss the importance and use of lambda (anonymous) functions. Give at least three examples.
8. Write a Python program that demonstrates: Default arguments, Keyword arguments,
Variable-length arguments.
9. Write Python functions for: Finding GCD of two numbers, Calculating exponents, Displaying the
Fibonacci series up to ‘n’ terms.
10. Explain the process of defining, calling, and returning values from a function with appropriate
examples.