Learn J2EE MCQs

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

Which method is used to forward a request from a servlet to another resource?

1) sendRedirect()

2) forward()

3) include()

4) dispatch()

Answer : forward()

What does `JSP` stand for?

1) Java Server Pages

2) Java Servlet Pages

3) Java Static Pages

4) Java Secure Pages

Answer : Java Server Pages

Which of the following technologies is used for transaction management in J2EE?

1) JMS

2) JTA

3) JSP

4) JDBC

Answer : JTA

What is the purpose of the `destroy()` method in a servlet?

1) Initialize the servlet

2) Shut down the servlet

3) Process a request

4) Handle session data

Answer : Shut down the servlet

What is the role of `JSP` in J2EE?

1) Manage database connections

2) Generate dynamic web content

3) Handle messaging

4) Manage transactions

Answer : Generate dynamic web content

Which J2EE technology is used to manage database connections?

1) JNDI

2) JDBC

3) JMS

4) JTA

Answer : JDBC

What does `@Stateless` annotation define in J2EE?

1) A stateless session bean

2) A stateful session bean

3) A servlet

4) A JSP

Answer : A stateless session bean

Which of the following HTTP methods is idempotent?

1) POST

2) PUT

3) GET

4) DELETE

Answer : GET

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

1) Render dynamic content

2) Implement business logic

3) Handle client requests

4) Manage database connections

Answer : Implement business logic

What is the default encoding of a servlet response?

1) ISO-8859-1

2) UTF-8

3) ASCII

4) UTF-16

Answer : ISO-8859-1