Learn J2EE MCQs

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

Which J2EE pattern is used for front-end separation from business logic?

1) Model-View-Controller

2) Adapter

3) Singleton

4) Factory

Answer : Model-View-Controller

Which of the following is true about `Session` management in J2EE?

1) It allows sharing of data between requests

2) It persists user data indefinitely

3) It manages file uploads

4) It creates unique URLs for users

Answer : It allows sharing of data between requests

What does the `doPost()` method handle in a servlet?

1) Handles POST requests

2) Handles GET requests

3) Handles PUT requests

4) Handles DELETE requests

Answer : Handles POST requests

Which of the following is NOT a feature of J2EE?

1) Cross-platform support

2) Low scalability

3) Distributed applications

4) Component reusability

Answer : Low scalability

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

1) <filter>

2) <listener>

3) <servlet>

4) <filter-mapping>

Answer : <filter>

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

1) Processes HTTP requests

2) Initializes the servlet

3) Destroys the servlet

4) Manages sessions

Answer : Processes HTTP requests

What does `EAR` stand for in J2EE packaging?

1) Enterprise Archive

2) Enterprise Access Resource

3) Enterprise Access Runtime

4) Enterprise Application Runner

Answer : Enterprise Archive

Which of the following protocols is commonly used in J2EE for distributed computing?

1) HTTP

2) FTP

3) RMI

4) SMTP

Answer : RMI

Which Java class is used for handling HTTP requests in a servlet?

1) HttpServlet

2) JspServlet

3) JspPage

4) ServletFilter

Answer : HttpServlet

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

1) Session management

2) Client-side rendering

3) Business logic implementation

4) Messaging between components

Answer : Business logic implementation