java_ejb_2_0
TRANSCRIPT
Sample Code
Which one of the following design pattern strategies does the class "Sample" in the sample code above illustrate?
Choice 1 Immutable Business Delegate
Choice 2 Updatable Business Delegate
Choice 3 Immutable Value Object
Choice 4 Session Facade
Choice 5 Updatable Value Object
Java - EJB 2.0, Question 1 of 40
Image
Referring to the diagram above, which one of the following states the start and end locations of this transaction?
Choice 1 Start: AccountBean End: PaymentBean
Choice 2 Start: PurchaseBean End: PurchaseBean
Choice 3 Start: PurchaseBean End: AccountBean
Choice 4 Start: AccountBean End: PurchaseBean
Choice 5 Start: PurchaseBean End: PaymentBean
Java - EJB 2.0, Question 2 of 40
On which one of the following is asynchronous integration based?
Choice 1 Messages
Choice 2 Tight coupling
Choice 3 Blocking
Choice 4 RMI
Choice 5 CORBA
Java - EJB 2.0, Question 3 of 40
Which one of the following is one of the two types of JMS messaging models?
Choice 1 Remote method invocation
Choice 2 Upload and download
Choice 3 TCP/IP
Choice 4 Publish and subscribe
Choice 5 Deliver and extract
Java - EJB 2.0, Question 4 of 40
Scenario An entity bean has been developed to represent a customer. Referring to the above scenario, which one of the following entity bean calls removes the underlying customer data from the database?
Choice 1 ejbStore()
Choice 2 ejbDelete()
Choice 3 ejbRemove()
Choice 4 ejbLoad()
Choice 5 ejbCreate()
Java - EJB 2.0, Question 5 of 40
Scenario In an e-commerce application, it is likely that the number of clients accessing the application may increase significantly, for example, from one user per hour to 10,000 users per hour. Application components that maintain performance well in this scenario are often described as "scalable." Referring to the scenario above, which one of these component types generally performs well in handling the increased usage when clients do NOT require conversational state?
Choice 1 Synchronized bean
Choice 2 Stateful session bean
Choice 3 Standard JavaBean
Choice 4 Stateless session bean
Choice 5 Passivated bean
Java - EJB 2.0, Question 6 of 40
Which one of the following types of method does the bean provider define as abstract and use EJB-QL as declared in the deployment descriptor?
Choice 1 ejbCreate() methods
Choice 2 ejbHome...(...) methods
Choice 3 ejbSelect...(...) methods
Choice 4 ejbFind...(...) methods
Choice 5 ejbLoad() methods
Java - EJB 2.0, Question 7 of 40
In an application using Enterprise JavaBeans, which one of the following provides the implementation of the EJB object?
Choice 1 Deployment descriptor
Choice 2 Web container
Choice 3 EJB context
Choice 4 Client application
Choice 5 EJB container
Java - EJB 2.0, Question 8 of 40
Image
In the diagram above, what does "X" represent?
Choice 1 JavaServer Pages
Choice 2 Servlets
Choice 3 Remote interfaces
Choice 4 Client-side application components
Choice 5 Enterprise Beans
Java - EJB 2.0, Question 9 of 40
Which one of the following is a performance benefit of using message-driven beans?
Choice 1 A message can be sent to a message-driven bean without blocking the workflow of an application.
Choice 2 Message-driven beans are able to recognize a client's security identity more quickly.
Choice 3 There is no network overhead involved in sending messages, which increases data throughput.
Choice 4 Message-Oriented Middleware uses networking protocols, which are faster than RMI-IIOP.
Choice 5 You receive an instant response from the message-driven bean's business method.
Java - EJB 2.0, Question 10 of 40
What is a JNDI initial context?
Choice 1 It is the initial starting point at which naming and directory operations can be resolved.
Choice 2 It is the initialization procedure for an entity bean when loaded from the database.
Choice 3 It is the initial place at which the container-generated EJBObject is instantiated.
Choice 4 It is the initialization procedure for a stateful session bean with conversational state.
Choice 5 It is the initial object that provides run-time information about an enterprise bean's environment.
Java - EJB 2.0, Question 11 of 40
Under which directory is the ejb-jar.xml file found within the EJB-JAR Java archive file?
Choice 1 J2EE-INF
Choice 2 WEB-INF
Choice 3 META-INF
Choice 4 MANIFEST
Choice 5 EJB-JAR
Java - EJB 2.0, Question 12 of 40
Scenario Client code calls the method "create(Integer primaryKey)" on an entity home interface. A new entity bean with this primary key is then created in the EJB container. What happens in the EJB Container in the above scenario?
Choice 1 A bean instance is created but nothing is added to the database.
Choice 2 A bean instance moves from pooled state to ready state.
Choice 3 A bean instance is moved from passivated state to activated state.
Choice 4 A bean instance in the ready state loads pre-existing data from the database.
Choice 5 Another entity bean is removed from the database to make space for the new entity bean.
Java - EJB 2.0, Question 13 of 40
Image
Referring to the diagram above, if Company and Employee are entity beans, what is the term generally used to describe the relationship between the Company and Employee beans?
Choice 1 Superclass-to-subclass
Choice 2 One-to-many
Choice 3 Singular-to-plural
Choice 4 Unique-to-duplicate
Choice 5 Singleton-to-collection
Java - EJB 2.0, Question 14 of 40
Which one of the following code fragments tests to see if two remote references to enterprise beans refer to the same bean?
Choice 1 EJBObject.isTheSame(EJBObject obj)
Choice 2 EJBObject.isIdentical(EJBObject obj)
Choice 3 EJBObject.equals(EJBObject obj)
Choice 4 EJBObject.isEqual(EJBObject obj)
Choice 5 EJBObject.isEquivalent(EJBObject obj)
Java - EJB 2.0, Question 15
For each stateful session bean instance in an EJB container, what is the maximum number of clients it may have?
Choice 1 One
Choice 2 Two
Choice 3 Three
Choice 4 Four
Choice 5 There is no maximum number.
Java - EJB 2.0, Question 16 of 40
Scenario The primary key of a CustomerBean entity bean has been defined as one of its entity data fields, customerNumber. These customer numbers are also used by real-life customers to identify themselves when purchasing products from an e-commerce site. Referring to the scenario above, which one of the following is a potential disadvantage of using business data such as "customerNumber" as natural primary keys?
Choice 1 Using an existing data field is likely to cause errors in the database (in particular, duplicate key errors).
Choice 2 If the format of "customerNumber" is changed for business reasons, the application developer has to update that primary key field, as well as every place where it is used as a foreign key, throughout the whole database.
Choice 3 Much more effort needs to be put into designing the format of the "customerNumber" field so that only universally unique keys are generated.
Choice 4 It is not possible to use letter characters in the primary key because the word "Number" is a sub-string of the primary key name "customerNumber."
Choice 5 The database has a parallel field called "customerNumberPK" with the same data, which is redundant and uses up unnecessary storage space.
Java - EJB 2.0, Question 17 of 40
Sample Code
Referring to the sample code fragment above, which one of the following is the bean type?
Choice 1 BMT entity bean
Choice 2 CMP entity bean
Choice 3 CMX entity bean
Choice 4 BMC entity bean
Choice 5 BMP entity bean
Java - EJB 2.0, Question 18 of 40
Nav 19.
Sample Code
Referring to the code sample above, if the class Answer is NOT itself a remote object, which one Java interface must it implement?
Choice 1 java.io.Serializable
Choice 2 javax.jms.Message
Choice 3 java.rmi.Naming
Choice 4 javax.sql.DataSource
Choice 5 java.lang.Comparable
Java - EJB 2.0, Question 20 of 40
Sample Code
Referring to the sample code above, how does the OrderBean check whether or not its calling client matches the role name "admin"?
Choice 1 context.getCallerInRole("admin")
Choice 2 context.getCallerPrincipal("admin")
Choice 3 context.isCallerInRole("admin")
Choice 4 context.isCaller("admin")
Choice 5 context.isCallerPrincipal("admin")
Java - EJB 2.0, Question 21 of 40
Which one of the following method types found in the home interface do you use to locate existing entity bean data from the persistent store?
Choice 1 Select methods
Choice 2 Locate methods
Choice 3 Finder methods
Choice 4 Retrieve methods
Choice 5 Search methods
Java - EJB 2.0, Question 22 of 40
Sample Code
Which one of the following lines of code do you place at Line 12 in the sample code above?
Choice 1 dataSource = (DataSource) initContext.bind("java:comp/env/jdbc/Database").getDataSource();
Choice 2 dataSource = (DataSource) initContext.getEnvironment("java:comp/env/jdbc/Database");
Choice 3 dataSource = (DataSource) initContext.rebind("java:comp/env/jdbc/Database");
Choice 4 dataSource = (DataSource) initContext.forName("java:comp/env/jdbc/Database");
Choice 5 dataSource = (DataSource) initContext.lookup("java:comp/env/jdbc/Database");
Java - EJB 2.0, Question 23 of 40
Which one of the following methods sets the container-provided runtime context for an Entity Bean?
Choice 1 setEntityContext(EntityContext context)
Choice 2 setContext(Context context)
Choice 3 setEJBObject(EJBObject object)
Choice 4 setEnterpriseContext(EnterpriseContext context)
Choice 5 setEJBContext(EJBContext context)
Java - EJB 2.0, Question 24 of 40
Which one of the following bean instances can have a loopback call, allowing the bean instance to behave as a multi-threaded object?
Choice 1 Synchronized entity bean
Choice 2 Pooled stateless session bean
Choice 3 Stateful session bean
Choice 4 Stateless session bean
Choice 5 Re-entrant entity bean
Java - EJB 2.0, Question 25 of 40
During design, a method of a session bean corresponds to which one of the following parts of speech found in the requirements?
Choice 1 Noun
Choice 2 Verb
Choice 3 Subject
Choice 4 Adjective
Choice 5 Object
Java - EJB 2.0, Question 26 of 40
Sample Code
In the deployment descriptor fragment above, what does the <res-sharing-scope> element declare?
Choice 1 Serializable transactions are not allowed in the TestDB database because database records must always be shared.
Choice 2 Connections obtained through the javax.sql.DataSource resource manager connection factory reference can be shared.
Choice 3 Phantom reads may occur when accessing the TestDB database because database records can be shared.
Choice 4 Security principals using the javax.sql.DataSource resource manager connection factory reference can be shared.
Choice 5 Clients may share stateful session beans that access the TestDB database through the javax.sql.DataSource resource manager connection factory.
Java - EJB 2.0, Question 27 of 40
Which one of the following is the method that processes JMS messages?
Choice 1 public Message getMessage()
Choice 2 public void processMessage(Message message)
Choice 3 public void onMessage(Message message)
Choice 4 public Message receiveMessage()
Choice 5 public void receive(Message message)
Java - EJB 2.0, Question 28 of 40
What does the term "RMI-IIOP" mean?
Choice 1 Remote Method Invocation over Internet Inter-Orb Protocol
Choice 2 Remote Method Invocation over Internet Integration Objects Protocol
Choice 3 Remote Method Invocation with International Internet Objects Protocol
Choice 4 Remote Method Invocation for Industry Internet Objects Protocol
Choice 5 Remote Method Invocation over Isolated Internet Objects Protocol
Java - EJB 2.0, Question 29 of 40
Image
Referring to the diagram above, which one of the following methods is Method "X"?
Choice 1 setMessageDrivenContext(MessageDrivenContext context)
Choice 2 ejbStore()
Choice 3 onMessage(Message message)
Choice 4 ejbActivate()
Choice 5 Any business method, such as placeOrder()
Java - EJB 2.0, Question 30 of 40
Scenario A client of an enterprise bean wishes to execute a use case in a single business method but does not want to be held up waiting for a response from the enterprise bean before continuing. This would, for example, allow a Web page to state to a user: "We have received your
request, which we are currently processing." Which one of the following design patterns is suitable for the scenario above?
Choice 1 Business Interface
Choice 2 Message Facade
Choice 3 Data Access Object
Choice 4 Service Locator
Choice 5 Value Object
Java - EJB 2.0, Question 31 of 40
Which one of the following stateful session bean lifecycle methods may be defined with more than one parameter in its method signature?
Choice 1 Class.newInstance()
Choice 2 ejbRemove()
Choice 3 ejbActivate()
Choice 4 ejbCreate()
Choice 5 setSessionContext()
Java - EJB 2.0, Question 32 of 40
Which interface provides the method getHandle()?
Choice 1 EJBContext
Choice 2 EJBObject
Choice 3 EJBSecurity
Choice 4 EJBMetaData
Choice 5 EJBDeployment
Java - EJB 2.0, Question 33 of 40
Sample Code
Referring to the sample code above, if Line 6 throws a RuntimeException, what is the effect on the client that sent the message?
Choice 1 The client is not able to send messages since the RuntimeException causes the EJB container to
crash.
Choice 2 The client receives a special RuntimeException message that acknowledges that the exception happened.
Choice 3 The client is not able to send messages since the bean instance is in the "Does not exist" state.
Choice 4 The client looses the JMS connection.
Choice 5 The client does not notice anything; the EJB container passes messages from the JMS server to a different bean instance.
Java - EJB 2.0, Question 34 of 40
Which one of the following enterprise bean types does NOT use create() methods that have one or more parameters?
Choice 1 CMP entity bean
Choice 2 Stateless session bean
Choice 3 Stateful session bean
Choice 4 BMP entity bean
Choice 5 Entity bean using container managed transactions
Java - EJB 2.0, Question 35 of 40
Which one of the following enterprise bean types does NOT use create() methods that have one or more parameters?
Choice 1 CMP entity bean
Choice 2 Stateless session bean
Choice 3 Stateful session bean
Choice 4 BMP entity bean
Choice 5 Entity bean using container managed transactions
Java - EJB 2.0, Question 35 of 40
Text This is a method of the javax.ejb.EJBObject interface:
getEJBHome() Referring to the text above, what does the "getEJBHome()" method do?
Choice 1 It obtains the local interface.
Choice 2 It obtains the EJBObject implementation class.
Choice 3 It obtains the remote interface.
Choice 4 It obtains the local home interface.
Choice 5 It obtains the remote home interface.
Java - EJB 2.0, Question 37 of 40
Sample Code
Which one of the following exceptions must the method doSomething() declare that it does throw in the code shown above?
Choice 1 javax.ejb.FinderException
Choice 2 javax.ejb.CreateException
Choice 3 java.rmi.ServerException
Choice 4 java.lang.InterruptedException
Choice 5 java.rmi.RemoteException
Java - EJB 2.0, Question 38 of 40
Which method associates a session bean instance with information above its runtime context?
Choice 1 public void ejbCreate(Runtime rtm)
Choice 2 public void setSessionContext(SessionContext ctx)
Choice 3 public void ejbCreate()
Choice 4 public void setEnvironment(Environment env)
Choice 5 public void setRuntime(Runtime rtm)
Java - EJB 2.0, Question 39 of 40
Sample Code
Referring to the sample code above, when client code calls the method "create(testString)" on a stateful session bean home interface, which one of the following methods does the EJB container call on the stateful session bean class?
Choice 1 create(testString)
Choice 2 ejbActivate()
Choice 3 create()
Choice 4 ejbCreate()
Choice 5 ejbCreate(testStri
ng)
Java - EJB 2.0, Question 40 of 40
Sample Code
Which one of the following statements is true with respect to the deployment descriptor sample above?
Choice 1 The bean may hold conversational state on behalf of the client application that uses it.
Choice 2 The Bean Provider must handle transaction management in code by using the javax.transaction.UserTransaction interface.
Choice 3 The bean has local home and local interfaces as well as remote home and remote interfaces.
Choice 4 The bean is required to have member variables to monitor transactional state during transactions.
Choice 5 The container will start a new transaction if the bean is not called within the scope of a transaction.
Java - EJB 2.0, Question 1 of 40
Scenario Requirements call for the use of an existing legacy database for an EJB deployment. The EJB container does not provide the developer with tools for mapping the legacy database to fields in enterprise bean business objects. Which one of the following enterprise bean types is most applicable for use in the above scenario?
Choice 1 CMP entity bean
Choice 2 Stateful session bean
Choice 3 Stateless session bean
Choice 4 Message-driven bean
Choice 5 BMP entity bean
Java - EJB 2.0, Question 2 of 40
What are the typical contents of an ejb-client JAR file?
Choice 1 All the class files needed for the client to use an enterprise bean
Choice 2 An XML file containing details of the enterprise beans used by the client
Choice 3 An identical copy of the ejb-jar file on the server
Choice 4 The EJBObject and EJBHome object class files as implemented by the container
Choice 5 The Java source code files for the enterprise beans the client uses
Java - EJB 2.0, Question 4 of 40
Which transaction isolation level allows transactions but also allows dirty reads, phantom, reads, and repeatable reads?
Choice 1 TRANSACTION_REPEATABLE_READ
Choice 2 TRANSACTION_SERIALIZABLE
Choice 3 TRANSACTION_NONE
Choice 4 TRANSACTION_READ_UNCOMMITTED
Choice 5 TRANSACTION_READ_COMMITTED
Java - EJB 2.0, Question 5 of 40
In which one of the following types of bean is persistence management delegated to the EJB container?
Choice 1 Stateful session bean
Choice 2 Message-driven bean
Choice 3 BMP entity bean
Choice 4 CMP entity bean
Choice 5 Stateless session bean
Java - EJB 2.0, Question 6 of 40
Sample Code
Given the above session bean code sample, which one of the following transaction types do you use for deployment?
Choice 1 Bean-managed
Choice 2 Supports
Choice 3 RequiresNew
Choice 4 Required
Choice 5 Mandatory
Java - EJB 2.0, Question 9 of 40
Scenario A client of an enterprise bean wishes to execute a use case in a single business method but does not want to be held up waiting for a response from the enterprise bean before continuing. This would, for example, allow a Web page to state to a user: "We have received your request, which we are currently processing." Which one of the following design patterns is suitable for the scenario above?
Choice 1 Data Access Object
Choice 2 Business Interface
Choice 3 Value Object
Choice 4 Service Locator
Choice 5 Message Facade
Java - EJB 2.0, Question 10 of 40
Sample Code
Referring to the sample code above, which one of the following database schemas describes a valid and most logical way to map CompanyBean and EmployeeBean to a relational database using the database tables "Company" and "Employee"?
Choice 1
Choice 2
Choice 3
Choice 4
Choice 5
Java - EJB 2.0, Question 11 of 40
Image
Referring to the diagram above describing CMP entity bean relationships, which one of the following lines of code produces the effects of the "Before" and "After" relationships between Company and Employee entity beans?
Choice 1 Collection employeesA = companyA.getEmployees(); Collection employeesB = companyB.getEmployees(); employeesA.remove(employeesB);
Choice 2 Collection employeesA = companyA.getEmployees(); companyB.setEmployees(employeesA);
Choice 3 Collection employeesA = companyA.getEmployees(); Collection employeesB = companyB.getEmployees(); employeesA.addAll(employeesB);
Choice 4 Collection employeesB = companyB.getEmployees(); companyA.setEmployees(employeesB);
Choice 5 Collection employeesA = companyA.getEmployees();
Collection employeesB = companyB.getEmployees();
employeesB.addAll(employeesA);
Java - EJB 2.0, Question 13 of 40
Sample Code
Referring to the deployment descriptor fragment above, which one of the following specifies that the Company bean does NOT have duplicate Employee bean references?
Choice 1 <cmr-field-type>java.util.Set</cmr-field-type>
Choice 2 <cmr-field-no-duplicates/>
Choice 3 <cmr-field-type>java.util.Map</cmr-field-type>
Choice 4 <cmr-field-no-dups/>
Choice 5 <cmr-field-type>java.util.Collection</cmr-field-type>
Java - EJB 2.0, Question 15 of 40
In the EJB 2.0 spec, which one of the following protocols must the EJB container support when a standalone client accesses an EJB remote home object?
Choice 1 CORBA over any protocol
Choice 2 The container provider decides.
Choice 3 RMI over IIOP
Choice 4 RMI over JRMP
Choice 5 CORBA over IIOP
Java - EJB 2.0, Question 18 of 40
Text This is a method of the javax.ejb.EJBHome interface:
remove(java.lang.Object primaryKey) Referring to the text above, what does the "remove()" method do?
Choice 1 It removes a stateless session bean.
Choice 2 It removes an entity bean.
Choice 3 It removes the client application.
Choice 4 It removes a message-driven bean.
Choice 5 It removes a stateful session bean.
Java - EJB 2.0, Question 21 of 40
Which EJB deployment descriptor element is typically defined by the Application Assembler?
Choice 1 <ejb-class>
Choice 2 <persistence-type>
Choice 3 <ejb-name>
Choice 4 <container-transaction>
Choice 5 <entity>
Java - EJB 2.0, Question 23 of 40
Scenario A single Java class is used to encapsulate the business data of an
entity bean. This allows the business data to be returned to a remote client using only one method call. Which one of the following design patterns achieves the requirements described in the scenario above?
Choice 1 Model-View-Controller
Choice 2 Value Object
Choice 3 Data Access Object
Choice 4 Session Facade
Choice 5 Business Delegate
Java - EJB 2.0, Question 26 of 40
Which one of the following is an important performance benefit of using the Session Facade design pattern with remote clients?
Choice 1 It allows the remote clients to directly access the entity bean local interfaces, which are faster than remote interfaces.
Choice 2 It allows the remote client to cache entity bean remote references more efficiently.
Choice 3 It ensures that expensive network calls to perform business methods are minimized.
Choice 4 It allows the remote client to make direct fine-grained access calls to the entity bean.
Choice 5 It enables asynchronous operations that do not block application workflow.
Java - EJB 2.0, Question 29 of 40
Which type of EJB holds NO conversational state and is anonymous to the client?
Choice 1 Message-driven bean
Choice 2 Stateful session bean
Choice 3 Container-managed persistence entity bean
Choice 4 Standard JavaBean
Choice 5 Bean-managed persistence entity bean
Java - EJB 2.0, Question 31 of 40
Message-queuing is well-suited for which one of the following?
Choice 1 Asynchronous method calls
Choice 2 Streaming media
Choice 3 Authentication
Choice 4 Real-time processing
Choice 5 Serialized method calls
Java - EJB 2.0, Question 33 of 40
In order for a BMP entity bean's ejbRemove() method to identify
which data instance to delete from the database, which one of the following items of code must it contain?
Choice 1 A call to prepareStatement() to obtain a PreparedStatement from a database connection
Choice 2 A call the getConnection() which obtains a database connection from a DataSource
Choice 3 A call to ejbLoad() to reload the data from the database before deletion
Choice 4 A call to getPrimaryKey() that retrieves the bean's primary key from the bean's entity context
Choice 5 A call to ejbActivate() to ensure that the bean instance is active before deletion
Java - EJB 2.0, Question 35 of 40
With respect to CMP entity beans in an EJB 2.0 container, how does the bean provider implement "lazy-loading"?
Choice 1 The ejb-jar deployment descriptor element <lazy-loading/> must be declared for the entity bean.
Choice 2
Check against the bean's instance variables for null references. Also, only load the data in code when the data is needed, ensuring "lazy-loading."
Choice 3 Lazy-loading is a side-effect of declaring only "setter methods" and not declaring "getter methods."
Choice 4 It is only necessary to call the method "setLazyLoading(true)" with a Boolean value of "true" on the entity context.
Choice 5
The bean provider may not implement lazy-loading because the EJB container manages persistence and therefore implements any lazy-loading strategy.
Java - EJB 2.0, Question 36 of 40
Sample Code
Given the flawed method signature above, which one of the following statements correctly identifies the error?
Choice 1 The finder method cannot have a String argument for the primary key.
Choice 2 The method is named incorrectly.
Choice 3 The method throws incorrect exceptions.
Choice 4 The method has an incorrect access modifier.
Choice 5 The method has an invalid return type.
Java - EJB 2.0, Question 37 of 40
Which one of the following is a method of javax.ejb.EJBContext that returns an object that identifies the caller of an enterprise bean method?
Choice 1 getSignature()
Choice 2 getUserID()
Choice 3 getGuardInfo()
Choice 4 getLoginID()
Choice 5 getCallerPrincipal()
Java - EJB 2.0, Question 39 of 40
Text In the javax.ejb.SessionBean interface, there is a method called ejbActivate(). The javax.ejb.SessionBean interface is used by both stateless and stateful session beans. Referring to the text above, which one of the following describes what the ejbActivate() method can do on a stateless session bean?
Choice 1 It does nothing, and the method is never called.
Choice 2 It restores passivated conversational state during activation.
Choice 3 It creates a new stateless session bean instance.
Choice 4 It activates a new resource such as a database connection.
Choice 5 The method activates a business method called by the client.
Java - EJB 2.0, Question 40 of 40