|
Question 1. The following code shows the remote interface for a Travel Agent Bean: 1. package travlagent; 2. import Java.rmi.*; 3. 4. public interface TravelAgent exterds ETRObject. P 5. 6. public String getCustomer Destination () throws Remote Exception; 7. public String get Customer Flight () throws Remote Exception; 8. public String getCarRental () throws Remote Except_on: 9. public String get Customer Hotel () throws Remote Exception; 10. } Which statement is true of the remote interface? A. The remote interface will compile as expected and is a valid remote interface that may be used as an intermediate object for the TravelAGentBean. B. The remote interface will compile as expected but will not be a valid remote interface for the TravelAgentBean when compiled at deployment. C. The remote interface will not compile due to an error at line 5. D. The remote interface will not compile due to an error at line 4. Answer: Question 2. Which code performs a look-up of an enterprise bean's String environment property named app Env? A. Context ctx = new InitialContext (); Context beanEnv = (Context ctx. Lookup ("Java:prop/env"); String the Property = (String) ctx. Lookup ("beanEv.appEnv"); B. Context ctx = new InitialContext(); Context beanEnv= (context ctx.lookup("java:comp/env"); String the Property = (String) beanEnv.lookup ("appEnv"); C. Context ctx - new InitialContext(); Context beanEnv = (Context) ctx.lookup ("java:comp/env"); String theProperty = beanEnv. lockup ("appEnv"); Answer: Question 3. Which statement correctly describes the mechanism by which enterprise beans are instantiated? A. Enterprise beans are instantiated by calling a create () method on the bean's remote interface using a reference to the bean's home interface. Each create () method has a corresponding ejbCreate () method in the bean's home interface. B. Enterprise beans are instantiated by calling a create () method on the bean's remote interface using a reference to the bean's home interface. Each create () method has a corresponding ejbCreat () method in the bean's remote interface. C. Enterprise beans are instantiated by calling a create () method on the bean's home interface using a reference to the bean's remote interface. Each create () method has a corresponding ejbCreate () method in the bean's remote interface. D. Enterprise beans are instantiated by calling a create () method on the bean's home nterface using a reference to the bean's remote interface. Each create () method has a corresponding ejbCreate () method in the bean's home interface. Answer: Question 4. Consider the following four activities occur during a typical interaction between a client and an enterprise bean: 1. A reference to an EJB home object is returned to the client. 2. A reference to the EJB object is retuned to the client. 3. JNDI is used to acquire a reference to an enterprise bean's home object. 4. The client requests the bean's home object to create or find an enterprise bean. Which choice lists the correct order in which these activites occur during a typical interaction between a client and an EJB? A. 3, 2, 4, 1 B. 4, 3, 1, 2 C. 3, 1, 4, 2 D. 4, 3, 2, 1 Answer: Question 5. What is the superclass for system exceptions in an enterprise bean? A. java.lang.RuntimeException B. javax.ejb.EJBException C. java.rmi.RemoteException D. javax.ejb.CreateException Answer: Question 6. Which code demonstrates the proper method for using a resource factory reference named j dbc/MyDB in an enterprise bean? A. Context ctx = new InitialContext (); DataSource dtasrc = (Data Source) ctx.lookup ("java:prop/cnv/jdbc/MyDB"); B. Context ctx = new InitialContext (); Data Source dtasrc = Ctx.lookup ("java:comp/env/jdbc/MyDB:); C. Context ctx = new initialContext(); Data Source dtasrc = (Data Source) ctx. Lookup ("java:comp/env/jdbc/MyDB"); D. Context ctx = new initialContext(); Data Source dtasrc = Ctx.lookup("java:prop/env/jdbc/MyDB")' Answer: Question 7. An EJB client invokes a create () method. An EJB container instantiates an enterprise bean as the result of this method call. The bean is then held in a pool awaiting a method invocation. To which type of enterprise bean does this process refer? A. BMP entity bean B. CMP entity bean C. Stateless session bean D. Stateful session bean Answer: Question 8. You need to perform the look-up of the home object for an enterprise bean named TravelAgentBean and then create a reference to that object. You then need to call the proper method to instantiate the TravelAgentBean. The appropriate arguments for the InitialContext constructor are held in a Hashtable named srvrProps. Which code demonstrates this look-up and bean instantiation? A. Try | Context ini_Ctx = new IritialContext (srvPrcps); Object homeRef = initCtx. Lookup ("TravelAgentBeanJNDIName"); TravelAGentHome tah - tah.create (); } Catch (Exception e) { // code for exception B. try { Context initCtx = new Iritial Context (srvrPrcps); Object noneRef = initCtx.lookup! ("TravelAgentDeanJND=Name"); TravelAgentHome tan = (TravelAGentHome) PortableRemoteObject.narrow (homeRef, TravelAgentRemote.class); TravelAgent to = (TravelAgent, tah.create (); } Catch (Exception e) { //code for exception ) C. try: Context initCtx = new InitialContext (srvrProps); Object homeRef = initCtx.lookup ("TravelAgentBeanJNDIName"); TravelAGentHome tah = (TravelAgentHome) PortableRemoteObject.narrow (homeRef, TravelAgentHome.class); TravelAgent ta = tah.bCreate (); ) Catch (Exception e ) { / / code tor exception } D. Try: Context initctx - new InitialContext (srvrProps); Object homeRef = initCtx.lcckup ("TravelAgentBean JNDIName"); TravelAgentHome tah = (TravelAgentHome) ProtableRemoteObject.narrow (homeRef, TravelAgentHome.class); TravelAGent ta - tah.create (); } catch (Exception e) { / / code for exception } Answer: Question 9. Which statement lists the benefits of using container-managed persistence for entity beans? A. The bean developer must write less code; database operation optimization methods can be implemented; and bean code is more portable. B. Gugs are easier to find in container-generated code; bean developers can focus on business logic; and the container will require fewer resources when using CMP. C. Database connection calls are managed by the bean developer, CMP may reduce the number of bugs in bean code; and container-generated custom finder methods can be used. D The container provided mapping tools to map entity bean fields to a relation 's columns; EJB servers that provide high-end CMP services are less expensive; and CMP can support complex SQL JOIN operations. Answer: Question 10. Consider the following IDL definition: 1. module Account 2. { 3. Interface account 4. { 5. long accountNumber; 6. float balance; 7. }; 8. 9. interface accountFacucry 10. { 11. Account getAccount (in Long accountNumber) throws (AccountNotFound); 12. string message; 13. }; 14. 15. Account getAccoun (in Long accountNumber) throws (AccountNotFound); 16. }; 17. }; Which statement correctly describes this IDL definition? A. The IDL definition properly defines a factory object that may be used to obtain a reference to an Account object. B. The IDL definition cannot be compiled due to an error at line 15. C. The IDL definition cannot be compiled due to an error at line 11. D. The IDL definition cannot be compiled due to an error at line 5. Answer:
Copyright © 2004 CertsBraindumps.com Inc. All rights reserved.