Learn J2EE MCQs
Prepare J2EE MCQs (Multiple choice Questions) for exam and job interviews.
What does the `service()` method do in a servlet?
1) Processes requests and generates responses
2) Starts the servlet
3) Initializes the servlet
4) Ends the servlet lifecycle
Answer : Processes requests and generates responses
Which of these is used for communication between J2EE components?
1) JMS
2) JDBC
3) Servlet
4) JSP
Answer : JMS
Which tag is used to configure listeners in web.xml?
1) <listener>
2) <filter>
3) <servlet>
4) <context-param>
Answer : <listener>
What is the purpose of `Session Bean` in J2EE?
1) Handle business logic
2) Manage HTTP requests
3) Render dynamic web pages
4) Manage messaging
Answer : Handle business logic
Which method in a servlet processes HTTP requests?
1) service()
2) init()
3) doRequest()
4) destroy()
Answer : service()
What does the `doGet()` method do in a servlet?
1) Handles GET requests
2) Handles POST requests
3) Destroys the servlet
4) Initializes the servlet
Answer : Handles GET requests
Which of the following J2EE technologies is used to implement business logic?
1) Servlet
2) JSP
3) EJB
4) JDBC
Answer : EJB
What is the main function of the `JNDI` in J2EE?
1) Messaging
2) Database Connectivity
3) Directory Services
4) Web Services
Answer : Directory Services
Which of these components manage session beans in J2EE?
1) EJB Container
2) Servlet Container
3) Web Container
4) JDBC Container
Answer : EJB Container
What does the `destroy()` method do in a servlet?
1) Processes HTTP requests
2) Closes database connections
3) Terminates a servlet
4) Starts the servlet
Answer : Terminates a servlet