- 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 bean is represents persistent data storage?
Answer : B
Explaination
Entity bean represents persistent data storage.
Q 3 - Which of the following is correct about Persistence unit 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 : C
Explaination
Persistence unit describes the properties of persistence mechanism.
Q 4 - Which of the following is correct about mappedName attribute in @javax.ejb.EJB annotation?
A - It is used to specify name which will be used to locate the referenced bean in environment.
B - it is used to specify the interface type of the referenced bean.
C - It is used to provide name of the referenced bean.
D - It is used to specify the JNDI name of the referenced bean.
Answer : D
Explaination
mappedName attribute in @javax.ejb.EJB annotation is used to specify the JNDI name of the referenced bean.
Q 5 - Which of the following is true about @javax.ejb.Remote annotation?
A - @javax.ejb.Remote annotation is used to specify Remote interface(s) of a session bean.
Answer : D
Explaination
@javax.ejb.Remote annotation is used to specify Remote interface(s) of a session bean. This remote interface states the business methods of the session bean (which can be stateless or stateful). This interface is used to expose the business methods to reote clients which are running in different deployment/application as EJB.
Q 6 - Which of the following is correct about @PreRemove annotation for a entity bean?
A - Method is invoked when an entity is created in database.
B - Method is invoked after an entity is created in database.
C - Method is invoked when an entity is deleted from the database.
D - Method is invoked after an entity is deleted from the database.
Answer : C
Explaination
@PreRemove - method is invoked when an entity is deleted from the database.
Q 7 - Which of the following is correct about @PostLoad annotation for a entity bean?
A - Method is invoked before an entity is to be updated in the database.
B - Method is invoked when a record is fetched from database and loaded into the entity.
C - Method is invoked when an entity is deleted from the database.
D - Method is invoked after an entity is deleted from the database.
Answer : B
Explaination
@PostLoad - is invoked when a record is fetched from database and loaded into the entity.
Q 8 - Which of the following is correct about a Isolated transaction in EJB?
B - A transaction must keep the system in consistent state.
C - Each transaction executes independent of any other transaction.
D - Transaction should survive system failure if it has been executed or committed.
Answer : C
Explaination
Isolated - Each transaction executes independent of any other transaction.
Q 9 - Which of the following is correct about a NOT_SUPPORTED attrribute of Container Managed Transactions in EJB?
B - Indicates that a new transaction is to be started for the business method.
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 : D
Explaination
NOT_SUPPORTED - Indicates that business method should not be executed as part of transaction.
Q 10 - Which of the following is true about exceptions handling by EJB Container?
B - EJB Container wraps the exception into RemoteException and throws it to the client.
Answer : C
Explaination
When System Exception occurs, ejb container intercepts the exception, rollbacks the transaction and start the clean up tasks. It wraps the exception into RemoteException and throws it to the client.
To Continue Learning Please Login
Login with Google