Computer Knowledge
Java Enterprise and Web Technologies
2,279 Questions
Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.
HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts
Java Enterprise and Web Technologies Questions
-
bean
-
objects
-
classes & nterfaces
-
methods
C
Correct answer
Explanation
An Enterprise JavaBean (EJB) component is defined by a set of Java classes and interfaces, such as the bean implementation class, home interface, and component interface. Together, these define the EJB's lifecycle and client interactions, making this option the only complete definition.
-
store & retrieve data
-
call back the method
-
reside in different mechanism
-
hold the correct informtion
A
Correct answer
Explanation
EJB components, particularly entity beans, provide standard mechanisms to store and retrieve persistent business data from a database. While EJB supports distributed deployments, the primary service defined in this context is data storage and retrieval, making the other options incorrect.
-
Session bean
-
Entity bean
-
Message Driven bean
-
Object bean
A,B,C
Correct answer
Explanation
Enterprise JavaBeans (EJB) specification defines exactly three types of beans. Session beans encapsulate business logic and workflow. Entity beans represent persistent business data (now largely replaced by JPA entities). Message-driven beans handle asynchronous messaging via JMS. 'Object bean' is not a standard EJB type.
-
Session bean method
-
Entity bean method
-
Message driven method
-
Object Bean method
A
Correct answer
Explanation
Clients interact with session beans to access application business logic. Session beans serve as the client-facing business interface. Entity beans (in EJB 2.x) are for persistence and not directly invoked by clients. Message-driven beans process asynchronous messages and are also not directly invoked by clients.
-
stateless
-
statefull
-
BMP
-
CMP
A,B
Correct answer
Explanation
Session beans are categorized into exactly two types: stateless session beans (no conversational state maintained between calls, can be pooled) and stateful session beans (maintain client-specific state across method invocations). BMP (Bean-Managed Persistence) and CMP (Container-Managed Persistence) are persistence mechanisms for entity beans, not session bean types.
-
Beans need to hold information
-
retrieve data
-
connect the client
-
No data for a specific client
D
Correct answer
Explanation
Stateless session beans are used when business operations don't require maintaining client-specific data between method calls. They're more efficient as they can be pooled and shared across clients. Option D correctly describes this scenario. Options A and B suggest scenarios where state might be needed (better for stateful beans). Option C is irrelevant.
-
No data for a client
-
Beans needs to hold information across method invocations.
-
when business object should be stored
-
to send data for a specific application
B
Correct answer
Explanation
Stateful session beans are specifically designed to maintain conversational state with a specific client across multiple method invocations. This makes them ideal for multi-step workflows like shopping carts or wizard-style processes. Option B correctly describes this use case. Option A describes stateless beans. Options C and D are misleading.
-
when business object should be stored in persistant storage mechanism.
-
if information have to be passed from one group to other.
-
to review the data in other application
-
to check with the client.
A
Correct answer
Explanation
Entity beans are designed to represent business objects that need persistent storage - data that survives beyond application sessions. Option A correctly states this purpose. Entity beans map to database tables and handle CRUD operations. Options B, C, and D describe other concerns (communication, review, validation) not related to persistence.
-
simple instances
-
classes and objects
-
getter and setter methods
-
business application
A
Correct answer
Explanation
EJB specifications, particularly for stateless session beans, state that these beans do not maintain conversational client state and should not contain custom instance variables. Instead, they are deployed as simple instances managed by the container's pool to execute stateless business methods.
-
message driven bean
-
entity bean
-
stateles session bean
-
stateful session bean
A
Correct answer
Explanation
Message-driven beans (MDBs) do not expose remote or local client interfaces. Instead, they act as asynchronous message listeners that the EJB container invokes when messages arrive at their designated queue or topic. Session and entity beans require interfaces for clients to invoke their business methods.
C,D
Correct answer
Explanation
Entity beans in EJB 2.x support two persistence mechanisms: BMP (Bean-Managed Persistence) where the developer writes all database code, and CMP (Container-Managed Persistence) where the container handles persistence automatically. Options C and D correctly identify these. JMS and JAXM (A and B) are messaging technologies unrelated to entity bean persistence.
-
Servlet Interface
-
servlet mapping
-
Servlet Container
-
None of the Above
A
Correct answer
Explanation
All servlets must implement the javax.servlet.Servlet interface, either directly or by extending a class like GenericServlet or HttpServlet which already implements it. The Servlet interface defines the lifecycle methods (init, service, destroy) that all servlets must support.
-
HTTP
-
HTTPS
-
Both (A) and (B)
-
None of the Above
C
Correct answer
Explanation
HttpServlet supports both HTTP and HTTPS protocols. The servlet container handles the protocol layer transparently - the same HttpServlet code works regardless of whether the request comes over HTTP or HTTPS.
-
Servlets are server side components
-
Applets have GUI interface
-
Servlets have GUI interface
-
Applets are client side components
C
Correct answer
Explanation
The false statement is C - Servlets do NOT have GUI interfaces. Servlets are server-side components that generate dynamic content but run without any GUI. In contrast, applets are client-side components that DO have GUI interfaces.