Lambda Functions Questions and Answers
Practice ModeShowing 10 of 25 questions
Q1
What is a lambda function in Python?
Answer: Option B
Explanation: Lambda functions are anonymous functions defined with the lambda keyword
Q2
Which of the following is the correct syntax for a lambda function?
Answer: Option B
Explanation: Lambda functions use the syntax: lambda arguments: expression
Q3
What will be the output of: (lambda x: x**2)(5)?
Answer: Option B
Explanation: Lambda function squares the input value
Q4
Which of the following is a limitation of lambda functions?
Answer: Option C
Explanation: Lambda functions can only contain expressions, not statements
Q5
How do you create a lambda function with two arguments?
Answer: Option C
Explanation: Multiple arguments are separated by commas in lambda functions
Q6
What is the output of: f = lambda x, y: x + y; print(f(3, 4))?
Answer: Option A
Explanation: Lambda function adds two numbers
Q7
Which built-in function is commonly used with lambda functions?
Answer: Option C
Explanation: map(), filter(), and sorted() are commonly used with lambda functions
Q8
What will this code output: list(map(lambda x: x.upper(), ['a', 'b', 'c']))?
Answer: Option A
Explanation: map() applies lambda function to convert each element to uppercase
Q9
How do you filter even numbers using lambda?
Answer: Option A
Explanation: filter() with lambda can be used to select elements based on condition
Q10
What is the result of: (lambda x, y, z: x+y+z)(1, 2, 3)?
Answer: Option A
Explanation: Lambda function with three parameters adds all three values