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

Explaination

A stateful session bean is a type of enterprise bean which preserve the conversational state with client. A stateful session bean as per its name keeps associated client state in its instance variables.

Answer : B

Explaination

mappedName attribute in @javax.ejb.Stateless annotation is used to specify the JNDI name of the session bean.

Answer : D

Explaination

description attribute in @javax.ejb.MessageDrivenBean annotation is used to provide description of the message driven 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 : A

Explaination

@PostConstruct - method is invoked when a bean is created for the first time.

Q 7 - Which annotation is used to inject an datasource 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 an datasource into an ejb.

Answer : C

Explaination

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

Answer : A

Explaination

MANDATORY - Indicates that business method will execute as part of transaction otherwise exception will be thrown.

Answer : D

Explaination

EJB 3.0, ejb query language is quite handy to write custom queries without worrying about underlying database details. It is quite similar to HQL, hibernate query language and is often referred by name EJBQL.

ejb_questions_answers.htm
Advertisements