Learn J2EE MCQs

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

Which component in J2EE handles messaging?

1) JMS

2) JNDI

3) JDBC

4) JPA

Answer : JMS

Which of the following is NOT true about `HttpServletRequest`?

1) It can handle HTTP headers

2) It can handle session data

3) It can handle form data

4) It can handle HTTP responses

Answer : It can handle HTTP responses

Which of the following is a valid JAX-RS annotation for defining an HTTP PUT method?

1) @PUT

2) @POST

3) @GET

4) @DELETE

Answer : @PUT

Which HTTP status code indicates that a resource was not found?

1) 404 Not Found

2) 200 OK

3) 500 Internal Server Error

4) 301 Moved Permanently

Answer : 404 Not Found

What is the primary purpose of `JMS` in J2EE?

1) Asynchronous messaging

2) Synchronous messaging

3) Database transactions

4) Session management

Answer : Asynchronous messaging

Which of the following is used to manage database connections in J2EE?

1) JDBC

2) JPA

3) EJB

4) JNDI

Answer : JDBC

What is the default lifecycle method of a servlet?

1) init()

2) destroy()

3) service()

4) doGet()

Answer : service()

Which tag is used to define a servlet in `web.xml`?

1) <servlet>

2) <filter>

3) <listener>

4) <context-param>

Answer : <servlet>

Which of the following technologies is used for web services in J2EE?

1) SOAP

2) JSP

3) JDBC

4) JMS

Answer : SOAP

What does `JNDI` stand for?

1) Java Naming and Directory Interface

2) Java Naming and Data Interface

3) Java Network and Directory Interface

4) Java Naming and Document Interface

Answer : Java Naming and Directory Interface