- 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 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 true about stateful bean?
A - EJB Container creates a separate stateful session bean to process client's each request.
B - As soon as request scope is over, statelful session bean is destroyed.
Answer : C
Explaination
EJB Container creates a separate stateful session bean to process client's each request. As soon as request scope is over, statelful session bean is destroyed.
Q 3 - Which of the following is correct about mappedName 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 : B
Explaination
mappedName attribute in @javax.ejb.Stateless annotation is used to specify the JNDI name of the session bean.
Q 4 - Which of the following annotation is used to specify that a given ejb class is a message driven bean?
Answer : C
Explaination
@javax.ejb.MessageDrivenBean annotation specifies that a given ejb class is a message driven bean.
Q 5 - Which of the following annotation is used to specify Remote interface(s) of a session bean?
Answer : C
Explaination
@javax.ejb.Remote annotation is used to specify Remote interface(s) of a session bean.
Q 6 - Which of the following is correct about @PostConstruct annotation for a callback method?
A - Method is invoked when a bean is created for the first time.
B - Method is invoked when a bean is removed from the bean pool or is destroyed.
Answer : A
Explaination
@PostConstruct - method is invoked when a bean is created for the first time.
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 a Durable 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 : D
Explaination
Durable - Transaction should survive system failure if it has been executed or committed.
Q 9 - Which of the following is correct about a Start 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 : A
Explaination
Start - When to start a transaction in a business method.
Q 10 - Which of the following is correct about a RolesAllowed attrribute of Container Managed Transactions in EJB?
A - Indicates that class will accept those declared roles. Annotations are applied at class level.
Answer : B
Explaination
RolesAllowed - Indicates that a method can be accessed by user of role specified. Can be applied at class level resulting which all methods of class can be accessed buy user of role specified.
To Continue Learning Please Login
Login with Google