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 is invoked by EJB container when it receives a message from queue or topic?

A - session bean.

B - entity bean.

C - message driven bean.

D - None of the above.

Answer : C

Explaination

Message driven bean is invoked by EJB container when it receives a message from queue or topic.

Answer : A

Explaination

name attribute in @javax.ejb.MessageDrivenBean annotation is used to specify name of the message driven bean.

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 - @javax.ejb.Local annotation is used to specify Local interface(s) of a session bean.

A - true

B - false

Answer : A

Explaination

@javax.ejb.Local annotation is used to specify Local interface(s) of a session bean.

Answer : B

Explaination

@PostPersist - method is invoked after an entity is created in database.

Q 7 - Which annotation is used to inject singleton services like timer service into an ejb?

A - @EJB

B - @Resource

C - Both of the above.

D - None of the above.

Answer : B

Explaination

@Resource annotation is used to inject singleton services like timer service into an ejb.

Answer : A

Explaination

A java POJO to be embedded must be annotated as @Embeddable.

Answer : C

Explaination

Failed - Identify failure scenario when a transaction is to be rollback.

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