Lambda expressions in Python provide a concise way to write anonymous functions using a single line of code. They’re widely used in functional programming, especially with functions like map(), filter(), and sorted().
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which keyword is used to define a lambda function?
Correct
Incorrect
Question 3 of 15
3. Question
What does this expression return?
x = lambda a: a + 5 x(3)
Correct
Incorrect
Question 4 of 15
4. Question
Which of the following is valid syntax?
Correct
Incorrect
Question 5 of 15
5. Question
Lambda functions can have
Correct
Incorrect
Question 6 of 15
6. Question
What is the result of:
(lambda x: x * 2)(4)
Correct
Incorrect
Question 7 of 15
7. Question
Which built-in function works best with lambda for filtering values?
Correct
Incorrect
Question 8 of 15
8. Question
What does this return?
list(filter(lambda x: x % 2 == 0, [1, 2, 3, 4]))
Correct
Incorrect
Question 9 of 15
9. Question
Which of the following will apply a lambda to every item in a list?
Correct
Incorrect
Question 10 of 15
10. Question
Which statement is true about lambda and `def` functions?
Correct
Incorrect
Question 11 of 15
11. Question
Which line returns the square of a number using lambda?
Correct
Incorrect
Question 12 of 15
12. Question
Which expression correctly uses lambda to sort a list of tuples by second item?
Correct
Incorrect
Question 13 of 15
13. Question
What does this code do?
add = lambda x, y=10: x + y add(5)
Correct
Incorrect
Question 14 of 15
14. Question
Which is a limitation of lambda functions?
Correct
Incorrect
Question 15 of 15
15. Question
Can lambda functions be assigned to a variable?
Correct
Incorrect
Summary
This quiz tested your knowledge of **Python lambda expressions**, covering syntax, usage with `map()`, `filter()`, default arguments, and differences with regular functions. Lambda is essential for concise, functional-style programming in Python.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.