Tag: java

Questions Related to java

  1. transactional components.

  2. client side security and encryption.

  3. distributed object components.

  4. server-side components.


Correct Option: B
Explanation:

To solve this question, the user needs to have knowledge about the EJB (Enterprise JavaBeans) specification architecture.

The EJB specification architecture defines the structure and behavior of Enterprise JavaBeans, which are server-side components used to develop scalable and distributed enterprise applications.

Let's go through each option and explain why it is right or wrong:

A. transactional components: This option is incorrect. The EJB specification architecture does define transactional components. EJBs can participate in transactions, allowing for ACID (Atomicity, Consistency, Isolation, Durability) properties.

B. client-side security and encryption: This option is correct. The EJB specification architecture does not define client-side security and encryption. It primarily focuses on server-side components and does not specify how the client-side should handle security and encryption.

C. distributed object components: This option is incorrect. The EJB specification architecture does define distributed object components. EJBs are designed to be distributed across multiple servers and can be accessed remotely.

D. server-side components: This option is incorrect. The EJB specification architecture does define server-side components. EJBs are specifically designed to run on the server-side and provide services to client applications.

Therefore, the correct answer is:

The Answer is: B

What executes EJB components?

  1. a web server

  2. an EJB container

  3. an application server

  4. a database server


Correct Option: B
Explanation:

To understand which component executes EJB components, we need to have knowledge about the architecture of Enterprise JavaBeans (EJB) and the roles of different servers in the execution process.

EJB components are server-side components that are used to implement business logic in Java EE applications. They are executed by an EJB container, which is responsible for managing the lifecycle, deployment, and execution of EJB components.

Now let's go through each option and explain why it is right or wrong:

A. a web server: This option is incorrect. A web server is responsible for handling HTTP requests and serving web pages. It does not execute EJB components.

B. an EJB container: This option is correct. An EJB container is specifically designed to execute EJB components. It provides services such as object pooling, concurrency management, security, and transaction management. The EJB container ensures that EJB components are executed in a managed environment.

C. an application server: This option is also correct. An application server is a runtime environment that provides various services to execute enterprise applications. It includes an EJB container as one of its components. The application server manages the execution of EJB components along with other components of the application.

D. a database server: This option is incorrect. A database server is responsible for storing and retrieving data. It does not execute EJB components.

Therefore, the correct answer is:

The Answer is: B. an EJB container

  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
  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.


Correct Option: B
Explanation:

To answer this question, the user needs to have knowledge of Enterprise JavaBeans (EJB) and how they are used in Java applications.

Now, let's go through each option and explain why it is right or wrong:

A. An EJB handle is used to handle exceptions when accessing EJB objects. This option is incorrect. An EJB handle is not used to handle exceptions. Exceptions in EJBs are typically handled using try-catch blocks or by declaring them in the method signature.

B. An EJB handle is used to store a reference to a specific EJB object. This option is correct. An EJB handle is used to store a reference to a specific EJB object. It allows the client to maintain a reference to an EJB object and use it to invoke methods on that object.

C. An EJB handle is part of the Home interface. This option is incorrect. An EJB handle is not part of the Home interface. The Home interface is used for creating and finding EJB objects, while the handle is used to store a reference to an existing EJB object.

D. An EJB handle is used for local references inside the EJB container. This option is incorrect. An EJB handle is not specific to local references inside the EJB container. It can be used for both local and remote references to EJB objects.

Therefore, the correct answer is:

The Answer is: B

  1. JNDI binding for local home interface

  2. Local home interface

  3. Home interface

  4. ejb-ref-type


Correct Option: C

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()


Correct Option: C

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


Correct Option: C

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)


Correct Option: B,E
  1. find methods

  2. multiple create() methods

  3. business methods

  4. remove() methods


Correct Option: A