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.

Questions and Answers

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.

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.

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?

A - @javax.ejb.Stateless

B - @javax.ejb.Stateful

C - @javax.ejb.MessageDrivenBean

D - @javax.ejb.EJB

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?

A - @javax.ejb.Stateless

B - @javax.ejb.Stateful

C - @javax.ejb.Remote

D - @javax.ejb.EJB

Answer : C

Explaination

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

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?

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

Start - When to start a transaction in a business method.

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.

ejb_questions_answers.htm
Advertisements