Challenge yourself with Python lambda functions multiple-choice questions (MCQs). Practice key concepts like syntax, usage with map/filter, and real-world applications.
add_ten = lambda x: x + 10
print(add_ten(5))
15
The lambda function adds 10 to the given input. 5 + 10 = 15.
mul = lambda a, b: a * b
print(mul(2, 4))
8
The lambda function multiplies the two inputs: 2 * 4 = 8.
is_even = lambda x: x % 2 == 0
print(is_even(6))
true
6 is divisible by 2, so the lambda function returns True.
(lambda x, y: x + y)(6, 8)
14
The lambda function adds 6 and 8, resulting in 14.
result = (lambda x, y: x * y)(5, 3)
print(result)
15
The lambda function multiplies 5 and 3, resulting in 15.
multiply = lambda x, y: x * y
mult = lambda x, y: multiply(x, y)
result = mult(6, 2)
print(result)
12
The first lambda `multiply` multiplies two numbers. The second lambda `mult` calls the first, so 6 * 2 = 12.