Learn J2EE MCQs
Prepare J2EE MCQs (Multiple choice Questions) for exam and job interviews.
What does `JTA` stand for?
1) Java Transaction Archive
2) Java Transaction API
3) Java Technology API
4) Java Tools API
Answer : Java Transaction API
Which J2EE design pattern is used to create reusable components?
1) Adapter
2) Factory
3) Decorator
4) Service Locator
Answer : Service Locator
Which J2EE container is responsible for managing session beans?
1) Web container
2) EJB container
3) JMS container
4) JNDI container
Answer : EJB container
What is the default scope of a servlet?
1) Request
2) Application
3) Session
4) Context
Answer : Application
What does the `@WebFilter` annotation do?
1) Registers a servlet
2) Registers a filter
3) Defines a JSP
4) Manages the session
Answer : Registers a filter
What is a valid return type for a servlet’s `service()` method?
1) void
2) String
3) int
4) boolean
Answer : void
Which of the following is a component of J2EE?
1) JSP
2) Hibernate
3) Spring
4) Angular
Answer : JSP
What does the `doPost()` method handle in servlets?
1) Processes POST requests
2) Processes GET requests
3) Initializes the servlet
4) Handles service requests
Answer : Processes POST requests
Which J2EE technology is used for managing transactions?
1) JMS
2) JTA
3) EJB
4) JNDI
Answer : JTA
What is the purpose of a `Stateful Session Bean`?
1) Handles multiple client requests
2) Maintains state between method calls
3) Acts as a single shared resource
4) Manages database connections
Answer : Maintains state between method calls