Tag: programming languages

Questions Related to programming languages

  1. A bean cannot use java.net.Socket.

  2. A bean instance variable cannot be declared static and final.

  3. A bean cannot listen on a socket as a server.

  4. A bean cannot use the java.io package.

  5. A bean cannot use this in the body of a class method.


Correct Option: C,D

Which of the following are valid entries in the deployment descriptor?

  1. int

  2. short

  3. java.lang.Boolean

  4. java.lang.Character


Correct Option: C,D
  1. Once acquired, the home interface can be used only once.

  2. Each instance of a session bean has its own EJBHome object.

  3. The InitialContext must be narrowed before it can be used to get the

  4. Only remote clients need to get the home interface; local clients can get to the

  5. The local client can use the home interface to remove the bean instance.

  6. None of the above.


Correct Option: F
  1. L can pass its reference for B as a return value of a method call from R.

  2. R can pass its reference for B as a parameter in a method call to L.

  3. L cannot call methods on R. Doesn’t this depend on what R actually is, and where it is located

  4. L cannot call methods on B.


Correct Option: B,C

Which of the following statements are true about a session bean client?

  1. A local client can remove the bean by invoking a method on the home interface

  2. Only a remote client can use the remove() method in the component interface.

  3. A stateful session bean is created by the container when the client invokes a create() method on the home interface.

  4. A create call from a client on a stateless session bean may not result in creating any instance of the bean. The container can create stateless session bean instances before any call from the client.

  5. A remove call from a client on a stateless session bean instance results in removing the instance.


Correct Option: C,D
  1. setSessionContext()

  2. ejbCreate() method of a stateless session bean

  3. ejbCreate() method of a stateful session bean

  4. None of the above


Correct Option: C
  1. Call ejbCreate().

  2. Implement javax.ejb.SessionBean.

  3. Implement javax.ejb.EJBContext.

  4. Implement ejbRemove().

  5. Implement setSessionContext().


Correct Option: A,C

Which of the following statements are true about a stateful session bean?

  1. An ejbRemove() call from the container removes the bean instance and puts it out for the garbage collector.

  2. An ejbCreate() call is made by the container only when a client invokes a create method.

  3. You can get the security information about a client from inside the ejbCreate() method.

  4. The container will call the setSessionContext() method only once.

  5. All of the above.


Correct Option: E
  1. ejbRemove()

  2. ejbPassivate()

  3. setSessionContext()

  4. ejbCreate()

  5. None of the above


Correct Option: C
  1. javax.ejb.NoSuchObjectLocalException for the local client

  2. javax.ejb.NoSuchObjectException for the remote client

  3. javax.ejb.RemoveException

  4. javax.ejb.ObjectNotFoundException

  5. java.rmi.NoSuchObjectException for the remote client


Correct Option: A,E