
Java 8 Lambda & Streams
Authored by Pawan G
Other
Professional Development
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between the Stream.sorted() and Stream.sort() methods in Java 8?
What is the difference between the Stream.sorted() and Stream.sort() methods in Java 8?
Stream.sorted() returns a new stream with the elements sorted, while Stream.sort() modifies the original stream in place.
Stream.sorted() performs a stable sort, while Stream.sort() performs an unstable sort.
Stream.sorted() accepts a Comparator as an argument, while Stream.sort() does not
There is no difference, they are synonyms.
2.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
What is the purpose of the Stream.distinct() method in Java 8?
What is the purpose of the Stream.distinct() method in Java 8?
To remove duplicate elements from the stream based on their hashcode and equals methods.
To return a stream that contains only the first occurrence of each element in the original stream.
To return a stream that contains only the elements that are different from their adjacent elements in the original stream.
Don't know..
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of applying the Stream.count() method to an empty stream in Java 8?
What is the result of applying the Stream.count() method to an empty stream in Java 8?
0
1
null
An exception is thrown
4.
MULTIPLE CHOICE QUESTION
1 min • 2 pts
What is the output of the following code snippet?
List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "David");
.filter(name -> name.length() > 4)
.map(name -> name.toUpperCase())
.forEach(System.out::println);
What is the output of the following code snippet?
List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "David");
.filter(name -> name.length() > 4)
.map(name -> name.toUpperCase())
.forEach(System.out::println);
ALICE BOB CHARLIE DAVID
ALICE CHARLIE DAVID
BOB CHARLIE DAVID
CHARLIE DAVID
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is not a valid way to create a lambda expression in Java 8?
Which of the following is not a valid way to create a lambda expression in Java 8?
(int x) -> x * x
x -> x * x
x -> { return x * x; }
(x) -> return x * x;
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a terminal operation in the Stream API in Java 8?
Which of the following is a terminal operation in the Stream API in Java 8?
map
filter
reduce
all of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid way to create a date object in Java 8?
Which of the following is a valid way to create a date object in Java 8?
LocalDate date = new LocalDate(2024, 2, 6);
LocalDate date = LocalDate.of(2024, 2, 6);
LocalDate date = LocalDate.parse(“2024-02-06”)
Both b) and c)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Other
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...