Learn J2EE MCQs

Prepare J2EE MCQs (Multiple choice Questions) for exam and job interviews.

Which method is used to invalidate a session in J2EE?

1) session.close()

2) session.invalidate()

3) session.stop()

4) session.destroy()

Answer : session.invalidate()

What is `WAR` in J2EE?

1) Web Application Resource

2) Web Application Archive

3) Web Application Registry

4) Web Access Resource

Answer : Web Application Archive

Which of these is a valid tag in `web.xml`?

1) <servlet-name>

2) <filter-mapping>

3) <bean-name>

4) <application-name>

Answer : <servlet-name>

What does `init()` method do in a servlet?

1) Handles client requests

2) Initializes the servlet

3) Processes the request

4) Handles HTTP responses

Answer : Initializes the servlet

What is the role of a `Servlet Filter`?

1) Modify request/response

2) Manage transactions

3) Handle database connections

4) Render dynamic content

Answer : Modify request/response

Which of the following technologies is used to connect J2EE applications to a database?

1) JMS

2) JDBC

3) JNDI

4) Servlets

Answer : JDBC

Which method in J2EE servlets handles all types of HTTP requests?

1) doGet()

2) service()

3) doPost()

4) init()

Answer : service()

Which of the following is NOT a feature of `Session` in J2EE?

1) Allows storing client data

2) Maintains data across requests

3) Handles dynamic page rendering

4) Expires after a period of inactivity

Answer : Handles dynamic page rendering

Which J2EE component handles messaging between applications?

1) EJB

2) JMS

3) JNDI

4) Servlet

Answer : JMS

What does `JDBC` stand for?

1) Java Database Connectivity

2) Java Data Compiler

3) Java Distributed Compiler

4) Java Debugging Console

Answer : Java Database Connectivity