Python Functions
Python Functions - Important Points
6. | What is the purpose of the **kwargs parameter in a function definition? |
---|
A. It allows the function to accept a variable number of positional arguments
B. It allows the function to accept a variable number of keyword arguments
C. It defines the default arguments for a function
D. It defines the required arguments for a function
View Answer Discuss Work SpaceAnswer: option b
Explanation:
7. | What is the output of the following code? |
---|
A. 5
B. 10
C. 15
D. 50
View Answer Discuss Work SpaceAnswer: option c
Explanation:
8. | What is the output of the following code? |
---|
A. 5
B. 10
C. 25
D. 50
View Answer Discuss Work SpaceAnswer: option c
Explanation:
9. | What is a lambda function in Python? |
---|
A. A function that is defined within another function
B. A function that can be called recursively
C. A function that is defined using the lambda keyword and has no name
D. A function that is defined using the def keyword and has no name
View Answer Discuss Work SpaceAnswer: option c
Explanation:
10. | What is the purpose of the map function in Python? |
---|
A. It applies a function to each element of an iterable and returns a new iterable
B. It filters an iterable based on a given function
C. It converts an iterable to a dictionary
D. It sorts an iterable based on a given function
View Answer Discuss Work SpaceAnswer: option a
Explanation: