0

Java EJB Quiz

Description: Java EJB Quiz
Number of Questions: 10
Created by:
Tags: java ejb
Attempted 0/10 Correct 0 Score 0

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


Correct Option: B
  1. javax.ejb.MessageDrivenBean

  2. java.io.Serializable

  3. javax.enterprise.deploy.model.J2eeApplicationObject

  4. javax.jms.MessageListener

  5. javax.ejb.EJBException


Correct Option: A,D

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


Correct Option: A
  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.


Correct Option: A,E
  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


Correct Option: B

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.


Correct Option: C

AI Explanation

To answer this question, we need to understand the purpose of the EJB Query Language (EJB QL) and how it is used.

Option A) to enhance the SQL96 standard with additional options for complex relationships This option is incorrect. EJB QL is not used to enhance the SQL96 standard. It is a separate query language specifically designed for working with Enterprise JavaBeans (EJBs).

Option B) instead of the findByPrimaryKey() method, to define alternative selection criteria This option is incorrect. EJB QL is not used as an alternative to the findByPrimaryKey() method. The findByPrimaryKey() method is used to retrieve an entity bean based on its primary key, while EJB QL is used for querying entities based on various criteria.

Option C) to specify a concrete implementation for the find and select methods of CMP entity beans This option is correct. EJB QL is used to specify the queries for the find and select methods of Container Managed Persistence (CMP) entity beans. These methods are used to retrieve data from the underlying database using the specified query.

Option D) for accessing User Defined data types and Stored Procedures in the database. This option is incorrect. EJB QL is not used for accessing User Defined data types and Stored Procedures in the database. It is primarily used for querying and retrieving data from entity beans.

Therefore, the correct answer is C) to specify a concrete implementation for the find and select methods of CMP entity beans.

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


Correct Option: A,D

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.


Correct Option: C
- Hide questions