Python Functions Questions and Answers
Practice ModeShowing 10 of 25 questions
Q21
What is a pure function?
Answer: Option C
Explanation: A pure function is a function that always produces the same output for the same input and has no side effects.
Q22
What is a higher-order function?
Answer: Option B
Explanation: A higher-order function is a function that takes another function as an argument or returns a function.
Q23
Which built-in function is used to get a list of all attributes and methods of an object?
Answer: Option B
Explanation: The dir() function returns all attributes and methods of the specified object, without the values.
Q24
What is function composition?
Answer: Option B
Explanation: Function composition is combining two or more functions to produce a new function.
Q25
What is the purpose of the map() function?
Answer: Option B
Explanation: The map() function applies a given function to each item of an iterable and returns a map object.