Learn J2EE MCQs

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

What is the purpose of `JCA` in J2EE?

1) Resource adapter connectivity

2) Database transactions

3) Session management

4) Handling HTTP requests

Answer : Resource adapter connectivity

Which method in servlets is used to handle HTTP DELETE requests?

1) doDelete()

2) doGet()

3) doPut()

4) doPost()

Answer : doDelete()

Which of the following is NOT a correct J2EE component?

1) Servlets

2) EJB

3) JSP

4) PHPBeans

Answer : PHPBeans

What is the use of the `service()` method in J2EE?

1) Handles all HTTP requests

2) Initializes the servlet

3) Destroys the servlet

4) Manages sessions

Answer : Handles all HTTP requests

What is the role of `Entity Beans` in J2EE?

1) Represent persistent data

2) Handle transactions

3) Process HTTP requests

4) Manage web pages

Answer : Represent persistent data

What does the `destroy()` method in a servlet do?

1) Releases resources and destroys the servlet

2) Initializes the servlet

3) Handles POST requests

4) Manages sessions

Answer : Releases resources and destroys the servlet

What is the purpose of `JAX-RS` in J2EE?

1) Create RESTful web services

2) Handle HTTP requests

3) Manage databases

4) Render JSPs

Answer : Create RESTful web services

Which of the following is NOT a valid HTTP method?

1) OPTIONS

2) TRACE

3) FETCH

4) POST

Answer : FETCH

What is the main advantage of using `JSP` over `Servlets`?

1) Easier to write and maintain

2) Better performance

3) More secure

4) More scalable

Answer : Easier to write and maintain

What is the purpose of the `@Stateful` annotation in J2EE?

1) Defines a stateful session bean

2) Defines a stateless session bean

3) Defines a servlet

4) Defines a listener

Answer : Defines a stateful session bean