Lambda Functions Questions and Answers

Python Programming - Lambda Functions Questions with Answers explore anonymous functions used for short, inline operations. These Python Lambda Functions Questions are important for TCS, Wipro, and SSC exams focusing on functional programming

Lambda Functions

Showing 10 of 25 questions
1. What is a lambda function in Python?
  • A named function defined with def keyword
  • An anonymous function defined with lambda keyword
  • A built-in function for mathematical operations
  • A function that returns multiple values
Show Answer Report
2. Which of the following is the correct syntax for a lambda function?
  • def lambda(x): return x*2
  • lambda x: x*2
  • function lambda(x) {return x*2}
  • lambda function(x): return x*2
Show Answer Report
3. What will be the output of: (lambda x: x**2)(5)?
  • 10
  • 25
  • 125
  • 52
Show Answer Report
4. Which of the following is a limitation of lambda functions?
  • They cannot have multiple arguments
  • They cannot return values
  • They can only contain a single expression
  • They cannot be assigned to variables
Show Answer Report
5. How do you create a lambda function with two arguments?
  • lambda x y: x + y
  • lambda (x, y): x + y
  • lambda x, y: x + y
  • lambda [x, y]: x + y
Show Answer Report
6. What is the output of: f = lambda x, y: x + y; print(f(3, 4))?
  • 7
  • 34
  • 12
  • Error
Show Answer Report
7. Which built-in function is commonly used with lambda functions?
  • print()
  • input()
  • map()
  • range()
Show Answer Report
8. What will this code output: list(map(lambda x: x.upper(), ['a', 'b', 'c']))?
  • ['A', 'B', 'C']
  • ['a', 'b', 'c']
  • [65, 66, 67]
  • Error
Show Answer Report
9. How do you filter even numbers using lambda?
  • filter(lambda x: x % 2 == 0, numbers)
  • filter(lambda x: x / 2, numbers)
  • filter(lambda x: x * 2, numbers)
  • filter(lambda x: x == even, numbers)
Show Answer Report
10. What is the result of: (lambda x, y, z: x+y+z)(1, 2, 3)?
  • 6
  • 123
  • 5
  • Error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test