EJB Mock Test


Advertisements


This section presents you various set of Mock Tests related to EJB Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

EJB Mock Test I

Answer : B

Explanation

EJB stands for Enterprise Java Bean.

Answer : D

Explanation

EJB stands for Enterprise Java Beans. EJB is an essential part of a J2EE platform. J2EE platform have component based architecture to provide multi-tiered, distributed and highly transactional features to enterprise level applications. EJB provides an architecture to develop and deploy component based enterprise applications considering robustness, high scalability and high performance.

Answer : A

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. Session bean gets destroyed as soon as user session terminates.

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

Explanation

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

Explanation

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

Explanation

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

Explanation

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

Explanation

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

Explanation

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

Explanation

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

Explanation

EJB Container normally creates a pool of few stateless bean's objects and use these objects to process client's request. Because of pool, instance variable values are not guaranteed to be same across lookups/method calls.

Q 14 - Which of the following bean stores data of a particular user for a single session?

A - session bean.

B - entity bean.

C - message driven bean.

D - None of the above.

Answer : A

Explanation

Session bean stores data of a particular user for a single session.

Q 15 - 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

Explanation

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

Q 16 - Which of the following bean is represents persistent data storage?

A - session bean.

B - entity bean.

C - message driven bean.

D - None of the above.

Answer : B

Explanation

Entity bean represents persistent data storage.

Answer : A

Explanation

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

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.

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.

Answer : B

Explanation

EntityManager is an interface to do data operations like add/delete/update/find on persistent object. It also helps to execute queries using Query interface.

Answer : A

Explanation

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

Answer : B

Explanation

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

Answer Sheet

Question Number Answer Key
1 B
2 D
3 D
4 A
5 D
6 C
7 D
8 B
9 D
10 C
11 C
12 C
13 C
14 A
15 C
16 B
17 A
18 B
19 B
20 A
21 B
22 C
23 D
24 A
25 B

ejb_questions_answers.htm

Advertisements