Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
22. Lambda Expressions and Functional Interfaces
This section
Practice test
13 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
5 cards from this lesson. Good the night before a test.
Try these first
- 1.
What is a lambda expression?
Hint
Think of it as a shortcut for writing a function.
- 2.
Provide a simple example of a lambda expression.
Hint
Consider what this lambda does without parameters.
- 3.
What is a lambda expression?
- A named function
- An anonymous function
- A regular function
Hint
Remember how it differs from regular named functions.
- 4.
True or False: A functional interface can have multiple abstract methods.
Hint
Think about the definition of a functional interface.
- 5.
Create a custom functional interface named 'StringProcessor' that processes a string and returns its length using a lambda expression.
Hint
What function processes and gives an output based on a string?
- 6.
Write a program that filters out all strings starting with the letter 'A' from a list of strings using lambda expressions.
Hint
Consider how you can identify and remove items based on a condition.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
3 more questions available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting