Lambda Functions Questions and Answers
Practice ModeShowing 10 of 25 questions
Q21
How do you check if a number is odd using lambda?
Answer: Option B
Explanation: Odd numbers have remainder 1 when divided by 2
Q22
What will be printed: f = lambda a, b: a if a > b else b; print(f(7, 3))?
Answer: Option A
Explanation: Lambda returns the larger of two numbers
Q23
Which data type can lambda functions return?
Answer: Option D
Explanation: Lambda functions can return any data type
Q24
What is the output of: list(map(lambda x: x*2, [1, 2, 3]))?
Answer: Option B
Explanation: map() applies the doubling operation to each element
Q25
How do you sort strings by their length using lambda?
Answer: Option A
Explanation: sorted() with key function can sort based on string length