Learn J2EE MCQs
Prepare J2EE MCQs (Multiple choice Questions) for exam and job interviews.
What is the use of `JPA` in J2EE?
1) For object-relational mapping
2) For creating web services
3) For sending messages
4) For managing HTTP requests
Answer : For object-relational mapping
What is the full form of `JMS` in J2EE?
1) Java Messaging Service
2) Java Messaging System
3) Java Method Service
4) Java Method System
Answer : Java Messaging Service
Which component of J2EE handles database connections?
1) Servlet
2) EJB
3) JDBC
4) JSP
Answer : JDBC
What is the default HTTP method used by forms if not specified?
1) POST
2) GET
3) PUT
4) DELETE
Answer : GET
Which of the following is used for distributed computing in J2EE?
1) RMI
2) JMS
3) JNDI
4) JSP
Answer : RMI
Which method in the `HttpServlet` class is used to handle both GET and POST requests?
1) doService()
2) doGet()
3) service()
4) doPost()
Answer : service()
Which type of EJB is designed to maintain a client’s state across method calls?
1) Stateful Session Bean
2) Stateless Session Bean
3) Entity Bean
4) Message-Driven Bean
Answer : Stateful Session Bean
What is the primary function of `JNDI` in J2EE?
1) Naming and Directory services
2) Session management
3) Message sending
4) Transaction management
Answer : Naming and Directory services
Which of the following is NOT a life cycle method of a servlet?
1) init()
2) destroy()
3) service()
4) execute()
Answer : execute()
What does the `@EJB` annotation in J2EE do?
1) Injects an EJB into the servlet
2) Defines an entity bean
3) Registers a servlet
4) Configures JPA
Answer : Injects an EJB into the servlet