Learn J2EE MCQs
Prepare J2EE MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of `Session` management in J2EE?
1) Maintaining user data across requests
2) Managing database connections
3) Handling security
4) Exception handling
Answer : Maintaining user data across requests
What is the main use of the `request.getParameter()` method in J2EE?
1) To get data from an HTTP request
2) To send data to a database
3) To manage a session
4) To set a cookie
Answer : To get data from an HTTP request
Which of the following is a JSP directive?
1) <%@ page %>
2) <%! include %>
3) <jsp:forward>
4) <% session %>
Answer : <%@ page %>
Which of these J2EE components is responsible for handling requests from the client?
1) Servlet
2) JDBC
3) EJB
4) JMS
Answer : Servlet
Which of the following is used to define a filter-mapping in web.xml?
1) <filter-mapping>
2) <mapping>
3) <servlet-mapping>
4) <context-mapping>
Answer : <filter-mapping>
Which of the following is a web service technology in J2EE?
1) RMI
2) SOAP
3) JMS
4) EJB
Answer : SOAP
Which type of EJB is used for managing asynchronous messaging?
1) Entity Bean
2) Session Bean
3) Message-Driven Bean
4) Stateful Session Bean
Answer : Message-Driven Bean
What is the role of the `service()` method in a J2EE servlet?
1) Send a response
2) Handle an exception
3) Handle a client request
4) Close the servlet
Answer : Handle a client request
Which J2EE design pattern is used to reduce network traffic by providing a shared object?
1) Singleton
2) Adapter
3) Flyweight
4) Decorator
Answer : Flyweight
Which of these is NOT part of the J2EE platform?
1) JSP
2) EJB
3) Swing
4) JMS
Answer : Swing