EJB Quiz

Java - EJB Quiz

11 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

ejbCreate() method of CMP bean returns.

  1. null
  2. Primary Key class
  3. Home Object
  4. Remote Object
Question 2 Multiple Choice (Single Answer)

The EJB specification architecture does NOT define

  1. transactional components.
  2. client side security and encryption.
  3. distributed object components.
  4. server-side components.
Question 3 Multiple Choice (Single Answer)

What executes EJB components?

  1. a web server
  2. an EJB container
  3. an application server
  4. a database server
Question 4 Multiple Choice (Single Answer)

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.
Question 5 Multiple Choice (Single Answer)

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
Question 6 Multiple Choice (Single Answer)

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()
Question 7 Multiple Choice (Single Answer)

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
Question 8 Multiple Choice (Multiple Answers)

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

  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)
Question 9 Multiple Choice (Single Answer)

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
Question 10 Multiple Choice (Single Answer)

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
Question 11 Multiple Choice (Single Answer)

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