Alien head

EJB Quiz

Description: Java - EJB Quiz
Number of Questions: 12
Created by:
Tags: java ejb

ejbCreate() method of CMP bean returns.

  1. null

  2. Primary Key class

  3. Home Object

  4. Remote Object

Answer: 1

How can a EJB pass it’s reference to another EJB ? Which of the following is correct syntax for an Abstract class ?

  1. abstract double area() { }

  2. abstract double area()

  3. abstract double area();

  4. abstract double area(); { }

Answer: 3

The EJB specification architecture does NOT define

  1. transactional components.

  2. client side security and encryption.

  3. distributed object components.

  4. server-side components.

Answer: 2

What executes EJB components?

  1. a web server

  2. an EJB container

  3. an application server

  4. a database server

Answer: 2

Which describes best an EJB handle?

  1. An EJB handle is used to handle exceptions when accessing EJB objects.

  2. An EJB handle is used to store a reference to a specific EJB object.

  3. An EJB handle is part of the Home interface.

  4. An EJB handle is used for local references inside the EJB container.

Answer: 2

When a developer declares an EJB local reference, what element does NOT need to be specified?

  1. JNDI binding for local home interface

  2. Local home interface

  3. Home interface

  4. ejb-ref-type

Answer: 3

For a stateful session bean, which method is activated by the container to save the state of the bean?

  1. ejbCreate()

  2. ejbPassivate()

  3. ejbStore()

  4. ejbSave()

Answer: 3

The EJB SessionContext can be used to get information about users calling session enterprise beans. Which information can NOT be retrieved?

  1. transactional information

  2. security information

  3. data source information

  4. timer service information

Answer: 3

Client programs that access EJBs make use of the Java Naming and Directory Interface (JNDI). To get access to a Person entity bean, which methods can be used? (2 correct answers). Assume the following code is used to establish the initial context:

  1. PersonHome ph = ctx.lookup("java:comp/env/ejb/Person");

  2. PersonLocalHome ph=(PersonLocalHome)ctx.lookup("java:comp/env/ejb/PersonLocalHome");

  3. PersonHome ph = ctx.lookup("java:comp/env/ejb/PersonHome");

  4. PersonHome ph = javax.rmi.PortableRemoteObject.narrow(ctx, PersonHome.class)

  5. PersonHome ph = (PersonHome)javax.rmi.PortableRemoteObject.narrow(ctx,PersonHome.class)

Answer: 2,5

What would be a typical use of ejbSelect() methods?

  1. Using ejbSelect() methods in session beans for specifying the selection criteria for a list

  2. Using ejbSelect() methods within ejbHome methods to return entities

  3. Using ejbSelect() methods to access fields of a bean instance

  4. Using ejbSelect() methods to perform operations not specific to a entity instance

Answer: 4

CMP fields in EJB 2.x are defined via

  1. static fields in the entity bean

  2. an abstract persistence schema

  3. EJB Query Language definitions in the deployment descriptor

  4. the persistence-type attribute in the deployment descriptor

Answer: 2

In order to use Container Managed Relations (CMR) fields in CMP entity beans, the developer Must

  1. declare the CMR member fields and add ejb-relationship definitions in the deployment descriptor

  2. implement the get/set methods for the CMR fields and add ejb-relationship definitions in the deployment descriptor

  3. implement the ejbLoad() and ejbStore() methods and add ejb-relationship definitions in the deployment descriptor

  4. declare abstract get/set methods for the CMR field and add ejb-relationship definitions in the deployment descriptor

Answer: 4
+ View questions