Java 8 Quiz Challenge Welcome to your Java 8 Mastery Quiz: Test Your Knowledge! 1. Which functional interface represents a supplier of results? Consumer Function Supplier Predicate None 2. What is the purpose of the forEach() method in Java 8 streams? To sort elements in natural order To collect elements into a collection To filter elements based on a predicate To iterate over elements in a collection None 3. Which interface is used to define custom functional interfaces in Java 8? Function Consumer @FunctionalInterface Predicate None 4. What does the reduce() method in Java 8 streams do? Applies a function to each element Filters elements based on a predicate Sorts elements in natural order Combines elements into a single value None 5. What is a lambda expression in Java 8? A collection data structure An anonymous function A lightweight thread A type of variable None 6. What does the map() method in the Stream API do? Sorts elements in natural order Reduces elements to a single value Filters elements based on a predicate Applies a function to each element None 7. How is a method reference represented in Java 8? :: -> => >> None 8. Which interface is a functional interface in Java 8? Serializable Runnable Comparator Callable None 9. Which method is used to terminate a stream and collect its elements into a collection? filter() forEach() map() collect() None 10. Which method is used to create an infinite stream in Java 8? filter() map() generate() limit() None Please share your feedback in the comment box below. Congratulations on completing the Java 8 Mastery Quiz! Explore Java 8 concepts further at JavaDZone. Name Email Time's upTime is Up! Leave a Comment Cancel replyCommentName Email Website Save my name, email, and website in this browser for the next time I comment. Δ