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

Entity beans represents persistent data storage. User data can be saved to database via entity beans and later on can be retrived from the database in the entity bean.

Answer : C

Explaination

A stateless session bean is a type of enterprise bean which is normally used to do independent operations. A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state.

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 or inject a dependency as ejb instance into another ejb?

A - @javax.ejb.Stateless

B - @javax.ejb.Stateful

C - @javax.ejb.MessageDrivenBean

D - @javax.ejb.EJB

Answer : D

Explaination

@javax.ejb.EJB annotation is used to specify or inject a dependency as ejb instance into another ejb.

Answer : D

Explaination

@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 : 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 : B

Explaination

@PostLoad - is invoked when a record is fetched from database and loaded into the entity.

Answer : C

Explaination

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

Answer : A

Explaination

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

Answer : D

Explaination

JNDI stands for Java Naming and Directory Interface. It is a set of API and service interfaces. Java based applications use JNDI for naming and directory services.

ejb_questions_answers.htm
Advertisements