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 : D

Explanation

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.

Answer : B

Explanation

A remote session bean is used in EJB if ejb client is in different environment where ejb session bean is to be deployed.

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

A - @javax.ejb.Stateless

B - @javax.ejb.Stateful

C - @javax.ejb.MessageDrivenBean

D - @javax.ejb.EJB

Answer : C

Explanation

@javax.ejb.MessageDrivenBean annotation specifies that a given ejb class is a message driven bean.

Answer : D

Explanation

@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.

Answer : B

Explanation

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

Q 7 - Which annoatation is used to inject SessionContext into an ejb?

A - @EJB

B - @Resource

C - Both of the above.

D - None of the above.

Answer : B

Explanation

@Resource annotation is used to inject SessionContext into an ejb.

Answer : A

Explanation

REQUIRED - Indicates that business method has to be executed within transaction otherwise a new transaction will be started for that method.


ejb_questions_answers.htm

Advertisements