- 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 entity bean?
A - This type of bean stores data of a particular user for a single session.
Answer : C
Explaination
Entity beans represents persistent data storage. User data can be saved to database via entity beans and later on can be retrived from the database in the entity bean.
Q 2 - Which of the following is true about stateless bean?
Answer : C
Explaination
A stateless session bean is a type of enterprise bean which is normally used to do independent operations. A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state.
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 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 - @javax.ejb.PostActivate annotation is used to specify callback method of ejb lifecycle.
Answer : B
Explaination
@javax.ejb.PostActivate annotation is used to specify callback method of ejb lifecycle.
Q 6 - Which of the following is correct about @PostPersist 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 : B
Explaination
@PostPersist - method is invoked after an entity is created in database.
Q 7 - Which annoatation is used to inject SessionContext into an ejb?
Answer : B
Explaination
@Resource annotation is used to inject SessionContext into an ejb.
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 Success attrribute of Bean Managed Transactions in EJB?
A - When to start a transaction in a business method.
B - Identify success scenario when a transaction is to be committed.
C - Identify failure scenario when a transaction is to be rollback.
Answer : B
Explaination
Success - Identify success scenario when a transaction is to be committed.
Q 10 - Which of the following is correct about a DenyAll attrribute of Container Managed Transactions in EJB?
A - Indicates that class will accept those declared roles. Annotations are applied at class level.
Answer : D
Explaination
DenyAll - Indicates that business method is not accessible to any of user specified at class or at method level.
To Continue Learning Please Login
Login with Google