JavaBeat Feeds
|
|
|
|
|
|
|
|
|
|
SCBCD Mock Questions - 9
1)Consider the following fragment of client code involving session beans. Which of the following statements regarding this code are true? [Select all correct answers]
Assume that all reference variables have been declared
properly and the code has been compiled successfully.
4. Context initialContext = new InitialContext();
5. BasketHome basketHome = (BasketHome)
6. initialContext.lookup("java:comp/env/ejb/basket");
7. Basket basket1 = basketHome.create(discountVoucher);
8. Basket basket2 = basketHome.create(discountVoucher);
1)basket1 and basket2 are stateful session beans.
2)If basket1.isIdentical(basket2) is invoked after line 8, false is returned.
3)If basket1.isIdentical(basket2) is invoked after line 8, the client must handle javax.ejb.EJBException.
4)If basket1.getHandle() is invoked after line 8, a handle that can be serialized and written to stable storage is returned.
5)It is not possible to determine whether the client is local or remote.
2)Which of the following statements regarding a remote component interface of a session bean are true? [Select all correct answers]
1)All methods are defined to throw java.rmi.RemoteException.
2)Business methods can throw application specific exceptions.
3)Any methods invoked by a remote client may receive java.rmi.NoSuchObjectException.
4)The remove() method is defined to throw java.rmi.RemoveException.
5)The getHandle() method is defined to throw javax.ejb.ObjectNotFoundException.
3)Which of the following statements regarding a remote component interface of a session bean are true? [Select all correct answers]
1)Allows a client to get the primary key of the remote session bean.
2)Allows a client to get a handle for the session object.
3)Allows a client to get the remote home object.
4)Allows a client to get the EJBMetaData interface for the session bean.
5)Extends javax.ejb.EJBLocalObject either directory or indirectly.
4)Which of the following statements regarding a local home interface of a session bean is true?
1)Extends javax.ejb.EJBHome either directory or indirectly.
2)Allows a client to remove a session object.
3)Allows a client to get the metadata for the session bean through the javax.ejb.EJBMetaData interface.
4)Allows a client to find an existing session bean instance.
5)Does not allow a client to get a handle to the home interface.
5)Which of the following statements regarding a local component interface of a session bean are true? [Select all correct answers]
1)Allows a client to remove the session object.
2)Allows a client to get the local home object.
3)Allows a client to get a handle for the session object.
4)Allows a client to get the primary key of the local session bean.
5)Extends javax.ejb.EJBLocalObject either directly or indirectly.
6)Which of the following statements regarding the removal of a session object are true? [Select all correct answers]
1)The remote home interface allows a client to remove a session object.
2)The local home interface allows a client to remove a session object.
3)The home interface allows a client to remove a session object using a primary key.
4)A remote client must handle both java.rmi.RemoteException and javax.ejb.RemoveException when removing a session object.
5)A local client must handle both javax.ejb.EJBException and javax.ejb.RemoveException when removing a session object.
7)Consider the following fragment of client code that locates a session bean home interface through JNDI and creates a session object. Which of the following statements regarding this code is correct?
Assume that all reference variables have been declared properly
4. Context initialContext = new InitialContext();
5. TigerHome tigerHome = (TigerHome)
6. initialContext.lookup("java:comp/env/ejb/tiger");
7. Tiger tiger = tigerHome.create();
8. ...
1)javax.rmi.PortableRemoteObject.narrow(...) method must be used to convert the result of the JNDI lookup to the home interface type.
2)Invoking tiger.getHandle() returns a handle that can be serialized and written to stable storage.
3)Invoking a method throws javax.ejb.NoSuchObjectLocalException if the session object has been removed by the container.
4)Invoking tigerHome.getEJBMetaData() returns a EJBMetaData interface that can be used to discover metadata information about the bean.
5)Invoking tigerHome.getHomeHandle() returns a handle for the home object that can be serialized and written to stable storage.
8)Which functionality is provided that is common to both a session bean's remote and local component interfaces? [Select all correct answers]
1)Obtaining the session object's home interface.
2)Obtaining the session object's primary key.
3)Obtaining the handle of the session object.
4)Removing the session object.
5)Testing if a given session object is identical to the invoked session object.
9)Which of the following statements regarding session beans are true? [Select all correct answers]
1)Invoking javax.ejb.EJBObject.getPrimaryKey() on a session bean results in javax.ejb.EJBException been thrown.
2)Invoking javax.ejb.EJBLocalObject.getPrimaryKey() on a session bean results in javax.ejb.EJBException been thrown.
3)Invoking javax.ejb.EJBHome.remove(java.lang.Object primaryKey) on a session bean results in javax.ejb.RemoveException been thrown.
4)Invoking javax.ejb.EJBLocalHome.remove(java.lang.Object primaryKey) on a session bean results in javax.ejb.RemoveException been thrown.
5)Invoking javax.ejb.EJBHome.remove(java.lang.Object primaryKey) on a session bean results in java.rmi.RemoteException been thrown.
10)Which of the following statements regarding remote session object interfaces is true?
1)All methods in the remote home and remote component interfaces are defined to throw javax.ejb.RemoteException.
2)A handle for the session object that can be serialized and written to stable storage is obtained from the remote home interface.
3)The remote home interface must define a find method to allow a session object to be retrieved by its primary key.
4)The remote component interface must be located through a JNDI lookup and narrowed using javax.rmi.PortableRemoteObject.narrow(...).
5)All methods in the remote home and remote component interfaces are defined to throw java.rmi.RemoteException.
|