Q.1 What is a functional interface in Java, and what is its purpose? Explain with code example ? Q.2 Discuss the role of lambda expressions in functional interfaces with code example ? Q.3 Discuss the concept of default and static methods in functional interfaces. Why are they allowed, and how can they be used? Q.4 Explain method references in Java. Give examples of different types of method references. ? Q.5 What is the Java Stream API, How does it create a stream in Java ? Q.6 How does it perform Base64 encoding in Java? give a code example demonstrating the encoding of a string. Q. 7 What is the forEach method in Java, and which interfaces provide this method? Explain with examples. ? Q.8 How does the forEach method differ from a traditional for loop? Discuss the benefits and limitations of each with code example ?. Q.9 Explain how multiple resources can be managed within a single try-with-resources statement in java .? Q.10 What are type annotations and Repeating Annotations in Java, and how do they differ from regular annotations. ? Q.11 Discuss the limitations of using diamond syntax with anonymous inner classes. Why does the Java compiler impose these restrictions? Q.12 Explain the benefits of using switch expressions over switch statements with code example . How do they improve code readability and maintainability? Q.13 Explain the benefits of using records compared to traditional Java classes. How do they improve code conciseness and readability? Q.15 Explain the purpose and benefits of sealed classes in Java. How do they enhance the type hierarchy and maintainability?