- EJB Tutorial
- EJB - Home
- EJB - Overview
- EJB - Environment Setup
- EJB - Create Application
- EJB - Stateless Bean
- EJB - Stateful Bean
- EJB - Persistence
- EJB - Message Driven Beans
- EJB - Annotations
- EJB - Callbacks
- EJB - Timer Service
- EJB - Dependency Injection
- EJB - Interceptors
- EJB - Embeddable Objects
- EJB - Blobs/Clobs
- EJB - Transactions
- EJB - Security
- EJB - JNDI Bindings
- EJB - Entity Relationships
- EJB - Access Database
- EJB - Query Language
- EJB - Exception Handling
- EJB - Web Services
- EJB - Packaging Applications
- EJB Useful Resources
- EJB - Quick Guide
- EJB - Useful Resources
- EJB - Discussion
EJB Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to EJB Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is true about session bean?
A - This type of bean stores data of a particular user for a single session.
Answer : A
Explaination
Session bean stores data of a particular user for a single session. It can be stateful or stateless. It is less resource intensive as compared to entity beans. Session bean gets destroyed as soon as user session terminates.
Q 2 - Which of the following is true about stateless bean?
Answer : C
Explaination
EJB Container normally creates a pool of few stateless bean's objects and use these objects to process client's request. Because of pool, instance variable values are not guaranteed to be same across lookups/method calls.
Q 3 - Which of the following is correct about Data Source in EJB persistence API?
A - It is a persistent object representing the data-store record. It is good to be serializable.
C - It describes the properties of persistence mechanism.
D - It describes the data-store related properties like connection url. user-name,password etc.
Answer : D
Explaination
Data Source describes the data-store related properties like connection url. user-name,password etc.
Q 4 - Which of the following annotation is used to specify that a given ejb class is a stateful session bean?
Answer : B
Explaination
@javax.ejb.Stateful annotation specifies that a given ejb class is a stateful session bean.
Q 5 - @javax.ejb.ActivationConfigProperty annotation is used to specify properties required for a message driven bean.
Answer : A
Explaination
@javax.ejb.ActivationConfigProperty annotation is used to specify properties required for a message driven bean.
Q 6 - Which of the following is true about callbacks in EJB?
A - Callback is a mechanism by which life cycle of an enterprise bean can be intercepted.
B - EJB Container calls callbacks.
C - We can define callback methods in the ejb class itself or in a separate class.
Answer : D
Explaination
Callback is a mechanism by which life cycle of an enterprise bean can be intercepted. EJB 3.0 specification has specified callbacks for which callback handler methods are to be created. EJB Container calls these callbacks. We can define callback methods in the ejb class itself or in a separate class. EJB 3.0 has provided many annotations for callbacks.
Q 7 - Which annotation is used to inject singleton services like timer service into an ejb?
Answer : B
Explaination
@Resource annotation is used to inject singleton services like timer service into an ejb.
Q 8 - Which of the following is correct about @Embeddable annotation for a entity bean?
A - A java POJO to be embedded must be annotated as @Embeddable.
B - An entity bean to be embedded must be annotated as @Embeddable.
Answer : A
Explaination
A java POJO to be embedded must be annotated as @Embeddable.
Q 9 - Which of the following is correct about a NEVER attrribute of Container Managed Transactions in EJB?
B - Indicates if business method executes as part of transaction then an exception will be thrown.
C - Indicates that business method will execute as part of transaction.
D - Indicates that business method should not be executed as part of transaction.
Answer : B
Explaination
NEVER - Indicates if business method executes as part of transaction then an exception will be thrown.
Q 10 - Which of the following is true about exceptions handling by EJB Container?
Answer : C
Explaination
When Application Exception occurs, ejb container intercepts the exception but returns the same to the client as it is. It does not roll back the transaction unless it is specified in code by EJBContext.setRollBackOnly() method.
To Continue Learning Please Login
Login with Google