🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Lambdas and Functional Interfaces: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. Which interface fits a lambda that takes nothing and returns a value?
  3. Q3. Which interface is the best fit for (a, b) - a + b on two Integers giving an Integer?
  4. Q4. What does this print? (code)
  5. Q5. Which method reference is the same as s - s.trim()?
  6. Q6. Which is a valid lambda for Function<Integer, Integer?
  7. Q7. Does an interface with one abstract method and three default methods count as functional?
  8. Q8. What does this print? (code)
  9. Q9. Why must local variables used inside a lambda be effectively final?
  10. Q10. Which interface avoids boxing for a function from int to int?