EJB Online Quiz


Advertisements


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.

Questions and Answers

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 stores data of a particular user for a single session?

A - session bean.

B - entity bean.

C - message driven bean.

D - None of the above.

Answer : A

Explaination

Session bean stores data of a particular user for a single session.

Answer : B

Explaination

EntityManager is an interface to do data operations like add/delete/update/find on persistent object. It also helps to execute queries using Query interface.

Q 4 - Which of the following annotation is used to specify that a given ejb class is a stateless session bean?

A - @javax.ejb.Stateless

B - @javax.ejb.Stateful

C - @javax.ejb.MessageDrivenBean

D - @javax.ejb.EJB

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?

A - @javax.ejb.PostActivate

B - @javax.ejb.Local

C - @javax.ejb.Remote

D - @javax.ejb.EJB

Answer : A

Explaination

@javax.ejb.PostActivate annotation is used to specify callback method of ejb lifecycle.

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.

Answer : A

Explaination

Class level interceptor is invoked for every method of the bean.

Answer : C

Explaination

A transaction is a single unit of work items which follows the ACID properties.

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.


ejb_questions_answers.htm

Advertisements