You are on page 1of 5

Quiz for EJB Tutorial

hung1708@gmail.com

1. What does the EJB specification architecture define ?

Transactional components

Distributed object components

Server-side components

All of the above

2. What executes EJB components ?

A web server

An application server

An EJB container

A database server

3. What do enterprise beans use to communicate with the EJB container to get runtime context
information ?

The javax.ejb.EJBContext provided by the container

A JNDI ENC context

A javax.ejb.EJBHome object provided by the container

A javax.ejb.EJBMetaData object provided by the container

4. Through what interface does an application create, find, and remove enterprise beans ?

java.rmi.Remote

javax.ejb.EJBHome

javax.ejb.EJBObject

javax.ejb.EntityBean

5. What type of enterprise bean is used to embody business objects ?

javax.ejb.EnterpriseBean
java.rmi.Remote

javax.ejb.SessionBean

javax.ejb.EntityBean

6. What type of enterprise bean is used to embody application processing state information ?

javax.ejb.EnterpriseBean

javax.rmi.Remote

javax.ejb.SessionBean

javax.ejb.EntityBean

7. What interface must the enterprise bean implement so that an application can invoke its
operations ?

javax.ejb.EntityBean

javax.ejb.EJBHome

javax.rmi.Remote

javax.ejb.EJBObject

8. At what point, precisely, in the life-cycle is a container-managed entity bean considered


created ?

Immediately prior to the execution of its ejbCreate() method

Immediately after the execution of its ejbCreate() method

After the CMP bean's data has been committed to the underlying persistent datastore

During the execution of its ejbPostCreate() method

9. What distinguishes a bean-managed persistent (BMP) enterprise bean from a container-


managed persistent (CMP) enterprise bean ?

A BMP bean must implement the ejbLoad() and ejbStore() methods

A BMP bean can implement persistence to custom datastores such as legacy systems

A BMP bean is responsible for managing its own persistence to a persistent datastore

All of the above


10. What is a deployment descriptor ?

An XML file format used by the container to learn about the attributes of a bean, such as
transactional characteristics and access control

A method for transporting enterprise beans back and forth between systems

An XML file used by enterprise bean clients to learn about the attributes of a bean, such as
access control and transactional characteristics.

A format for bundling enterprise beans for delivery to customers.

11. A stateless session bean:

Is created when the client invokes sreate on the home

There must be one per client as long as the client is executing the business logic.

Is the most scalable type of bean

B and C are correct

12. What happens when you pass a serialized object as an argument or return value that
doesn't exist either in the Client or the Server ?

Nothing will happpen.

An error will occur

A run time exception is produced

none of these

13. When you pass a Remote object to or from a remote method, what is really passed ?

The Remote object reference

A local copy of the remote object.

None of these

The Remote object's stub

14. When a bean moves from the "does not exist" to the "method ready" status, in which order
do the events take place ?

construction,ejbCreate(),setSessionContext()

construction,setSessionContext(),ejbCreate()
setSessionContext() only take place.

None of these.

15. What is true for the isIdentical() method of the EJBObject interface for stateless session
beans ?

Returns true if the stubs refferring to two different Remote EJB objects.

Create the session bean.

All of the above.

None of these.

16. A Message-driven bean:

Has a client view

Doesn't feature a component interface.

Has a Remote interface

Has a local interface

17. An entity bean:

can be shared between multiple clients as long as the entity being shared is same.

Must have its EJBObject interface.

A and B are correct.

None of these.

18. Is an entity bean allowed to return objects that don't implement the component interface ?

Yes.

No.

Yes but only if they implement EJBHome interface

Yes but only if they are RMI-IIOP types

19. What would you do in the constructor of a stateful session bean ?

Access the beans JNDI environment.


Get a reference to the bean's home.

Just nothing.

None of these.

20. For remote objects Java passes objects:

By reference.

By object copy.

By producing a serialized copy.

B and C are correct.

Answers
1. D
2. C
3. A
4. B
5. D
6. C
7. D
8. B
9. D
10. A
11. D
12. C
13. D
14. B
15. A
16. B
17. C
18. D
19. C
20. D

You might also like