- 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 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 message driven bean?
A - Message driven bean is a stateless bean.
Answer : D
Explaination
A message driven bean is a type of enterprise bean which is invoked by EJB container when it receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task asynchronously.
Q 2 - Which of the following is correct about Entity 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 : A
Explaination
Entity is a persistent object representing the data-store record. It is good to be serializable.
Q 3 - Which of the following is correct about name attribute in @javax.ejb.Stateless annotation?
A - It is used to specify name of the session bean.
B - it is used to specify the JNDI name of the session bean.
Answer : A
Explaination
name attribute in @javax.ejb.Stateless annotation is used to specify name of the session bean.
Q 4 - Which of the following annotation is used to specify that a given ejb class is a stateless session bean?
Answer : A
Explaination
@javax.ejb.Stateless annotation specifies that a given ejb class is a stateless session bean.
Q 5 - Which of the following annotation is used to specify callback method of ejb lifecycle?
Answer : A
Explaination
@javax.ejb.PostActivate annotation is used to specify callback method of ejb lifecycle.
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 an ejb into another ejb?
Answer : A
Explaination
@EJB annotation is used to inject other EJB reference.
Q 8 - Which of the following types of java classes can be mapped using @Lob annotation?
Answer : C
Explaination
Both of the above classes can be mapped using @Lob annotation.
Q 9 - Which of the following is correct about a DeclareRoles attrribute of Container Managed Transactions in EJB?
A - Indicates that class will accept those declared roles. Annotations are applied at class level.
Answer : A
Explaination
DeclareRoles - Indicates that class will accept those declared roles. Annotations are applied at class level.
Q 10 - Which of the following is true about EJBQL EJB?
A - EJBQL stand for EJB Query Language.
Answer : D
Explaination
EJB 3.0, ejb query language is quite handy to write custom queries without worrying about underlying database details. It is quite similar to HQL, hibernate query language and is often referred by name EJBQL.