Application Lifecycle And Annotation - Study Mode

[#41] What is the purpose of the `@WebServlet` annotation in a Java web application?
Correct Answer

(A) To declare a servlet and its mapping

[#42] In a Java web application, what is the role of the `ServletContext` object?
Correct Answer

(D) It provides access to application-wide information and resources

[#43] What is the primary purpose of the `@PostConstruct` annotation in Java EE applications?
Correct Answer

(C) To specify a method to be executed after an instance is created and its dependencies are injected

[#44] In Java EE applications, what is the purpose of the `@Resource` annotation?
Correct Answer

(B) To specify a resource to be injected into a component

[#45] What is the `web.xml` deployment descriptor used for in a Java web application?
Correct Answer

(C) To configure web application settings and servlet mappings