Python Programming - Functions
Exercise : Functions - General Questions
- Functions - General Questions
76.
What does the
zip(*iterables)
function do?
Answer: Option
Explanation:
The
zip(*iterables)
function in Python combines multiple iterables element-wise into tuples.
77.
How can you define a lambda function that adds two numbers?
Answer: Option
Explanation:
The correct syntax for a lambda function that adds two numbers is
lambda x, y: x + y
.
78.
How can you use the
filter
function to filter out even numbers from a list?
Answer: Option
Explanation:
The correct usage of the
filter
function to filter out even numbers is filter(lambda x: x % 2 != 0, my_list)
.
79.
How can you define a generator function that yields squares of numbers up to a given limit?
Answer: Option
Explanation:
The correct definition for a generator function that yields squares of numbers up to a given limit is shown in option A.
80.
What is the purpose of the
functools.partial
function?
Answer: Option
Explanation:
The
functools.partial
function is used to create partial functions with default arguments.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers