Java EJB Quiz

Test your knowledge of Enterprise JavaBeans including session beans, entity beans, message-driven beans, EJB Query Language, and deployment configuration.

10 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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

  1. javax.ejb.EnterpriseBean
  2. javax.ejb.SessionBean
  3. javax.ejb.MessageBean
  4. javax.ejb.EntityBean
Question 2 Multiple Choice (Multiple Answers)

Which interfaces must be implemented by Message driven beans? (3 correct answers)

  1. javax.ejb.MessageDrivenBean
  2. java.io.Serializable
  3. javax.enterprise.deploy.model.J2eeApplicationObject
  4. javax.jms.MessageListener
  5. javax.ejb.EJBException
Question 3 Multiple Choice (Multiple Answers)

Which methods should NOT be defined inside the home interface of a session bean? (2 correct answers)

  1. find methods
  2. multiple create() methods
  3. business methods
  4. remove() methods
Question 4 Multiple Choice (Single Answer)

The persistence of Person and Address information in an application is implemented via BMP entity beans. Each Person must have exactly one Address. If a Person contains the primary key for Address in a persistent field, how should you implement the Person

  1. The ejbRemove() method of Person invokes the remove() method of Address.
  2. The ejbStore() method of Person invokes the ejbStore() method of Address.
  3. The ejbPassivate() method of Person invokes the ejbPassivate() method of Address.
  4. The ejbLoad() method of Person invokes the findByPrimaryKey() method of Address-Home.
  5. The ejbLoad() method of Person invokes the ejbLoad() method of Address.
Question 5 Multiple Choice (Single Answer)

Before a message-driven bean (MDB) can be tested, the J2EE application server has been installed on a test machine and a connection factory and destination have been configured for the JMS provider. What other configuration task MUST be completed before t

  1. The native library directory in the classpath must be specified
  2. A message listener port must be defined
  3. The message listener service must be enabled
  4. A message passivation directory must be specified
Question 6 Multiple Choice (Single Answer)

A course enrolment application needs to define a JDBC resource reference for a DB2 database in the deployment descriptor. Assuming that the name of the resource reference is "enrolment", what is the appropriate JNDI declaration?

  1. java:comp/env/jdbc/db2/enrolment
  2. java:comp/env/jdbc/enrolment
  3. java:comp/env/enrolment
  4. java:jdbc/env/db2/enrolment
Question 7 Multiple Choice (Single Answer)

The EJB Query Language is used

  1. to enhance the SQL96 standard with additional options for complex relationships
  2. instead of the findByPrimaryKey() method, to define alternative selection criteria
  3. to specify a concrete implementation for the find and select methods of CMP entity beans
  4. for accessing User Defined data types and Stored Procedures in the database.
Question 8 Multiple Choice (Single Answer)

Container managed transactions are defined via trans-attributes in the deployment descriptor. When a session bean demarcates the transaction and calls an Entity Bean, what is the best transactional setting for the Entity Bean?

  1. Supports
  2. Never
  3. Required
  4. RequiresNew
Question 9 Multiple Choice (Multiple Answers)

When a packaged enterprise application (EAR file) is deployed to the application server, which activities can be performed? (2 correct answers)

  1. Specify the "context root" for each web application
  2. Generate access beans for any enterprise beans
  3. Assign alias names to the attributes of the Entity beans
  4. Map the Entity beans’ attributes to the relational database tables
Question 10 Multiple Choice (Single Answer)

What isnottrue of a Java bean?

  1. There are no public instance variables.
  2. All persistent values are accessed using getxxxand setxxxmethods.
  3. It may have many constructors as necessary.
  4. All of the above are true of a Java bean.