Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 4 subjective questions Nested Class, Lambda Expressions, and Exceptions

CSE310 — Programming In Java 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Differentiate between a Static Nested Class and a Non-Static Nested Class (Inner Class) in Java.

  2. Question 2 of 20

    Explain the concept of Anonymous Inner Classes in Java. How are they useful for event handling or interface implementation?

  3. Question 3 of 20

    Define a Functional Interface in Java. How does the @FunctionalInterface annotation work, and what is its relationship with Lambda expressions?

  4. Question 4 of 20

    Describe the syntax of Lambda Expressions in Java. Provide examples for expressions with no parameters, single parameter, and multiple parameters.

  5. Question 5 of 20

    Discuss the Exception Hierarchy in Java. Explain the roles of Throwable, Error, Exception, and RuntimeException.

  6. Question 6 of 20

    Explain the keywords try, catch, and finally with a code example demonstrating the flow of execution.

  7. Question 7 of 20

    Distinguish between throw and throws keywords in Java.

  8. Question 8 of 20

    What is the Try-with-Resources statement in Java? How does it help in resource management compared to the traditional try-finally block?

  9. Question 9 of 20

    Explain the concept of Exception Propagation in Java.

  10. Question 10 of 20

    How can you handle multiple exceptions in a single catch block? Explain the Multi-catch feature introduced in Java 7.

  11. Question 11 of 20

    Describe the process of creating a Custom Exception (User-defined Exception) in Java. Provide a code example.

  12. Question 12 of 20

    What are Assertions in Java? Explain their syntax and how to enable them.

  13. Question 13 of 20

    Discuss the Java 8 Date/Time API utility classes. How do LocalDate, LocalTime, and LocalDateTime differ from the old Date class?

  14. Question 14 of 20

    What is a Local Inner Class? What are the restrictions on accessing local variables within a local inner class?

  15. Question 15 of 20

    Explain the difference between Checked and Unchecked exceptions with examples.

  16. Question 16 of 20

    Analyze the rules for Exception Handling with Method Overriding. What happens when a subclass overrides a method that throws an exception?

  17. Question 17 of 20

    Explain the purpose of the Period and Duration classes in the Java Date/Time API.

  18. Question 18 of 20

    Compare Lambda Expressions with Anonymous Inner Classes. When should you use one over the other?

  19. Question 19 of 20

    Write a Java program fragment to demonstrate how to handle a NullPointerException and an ArrayIndexOutOfBoundsException.

  20. Question 20 of 20

    What are the advantages of using Nested Classes in Java?

That's unit 4

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.