310-090 Sun Certified Business Component Developer for J2EE Set 8

Given this single enterprise bean method:

4. UserTransaction ut = ctx.getUserTransaction();

5. ut.begin();

6. // more code

17. ut.setRollbackOnly();

Assume that ctx is a valid EJBContext.

Which two statements are true? (Choose two.)

A. Compilation fails.

B. Deployment fails.

C. An exception is thrown at runtime.

D. This can be legal within a stateful session bean.

E. This can be legal within an entity bean's business methods.

F. This is never legal within a message-driven bean's onMessage method.

G. If the code runs successfully, the container ensures that the transaction will never commit.


Options are :

  • D,G
  • A,G
  • C,G
  • B,G

Answer : D,G

Which statement is true about the client view of a session bean's local component interface?


Options are :

  • The client cannot invoke the remove method on a stateful bean
  • Clients can access all of the methods in EJBObject
  • The isIdentical method always returns true when comparing two stateless beans with the same home.
  • The client cannot invoke business methods defined in the session bean's local interface

Answer : The isIdentical method always returns true when comparing two stateless beans with the same home.

310-090 Sun Certified Business Component Developer for J2EE Set 9

A stateful session bean is participating in a transaction that rolls back. Which method can the bean

use to restore its pre-transaction state?


Options are :

  • SessionContext.getUserTransaction
  • SessionSynchronization.beforeCompletion
  • SessionContext.setRollbackOnly
  • SessionSynchronization.afterCompletion

Answer : SessionSynchronization.afterCompletion

Which statement about message-driven beans is true?


Options are :

  • When dispatching messages to message bean instances, the container must preserve the order in which messages arrive.
  • If a message-driven bean is associated with a JMS durable subscription, each bean instance in the pool will receive each message sent to the durable subscription.
  • If a message-driven bean is associated with a JMS queue, each bean instance in the pool will receive each message sent to the queue
  • Each message-driven bean instance will be executed by at most one thread at a time.

Answer : Each message-driven bean instance will be executed by at most one thread at a time.

Which two are restrictions of bean-managed transactions? (Choose two.)

A. The NotSupported transaction attribute must be chosen.

B. Clients calling with a transactional context are prohibited and will result in an exception.

C. A stateful session bean must commit a started transaction before a business method returns.

D. A bean that starts a transaction must complete the transaction before it starts a new

transaction.

E. A message-driven bean instance must commit or rollback a transaction before the onMessage

method returns.


Options are :

  • C,E
  • D,E
  • B,E
  • A,E

Answer : D,E

310-091 Sun Certified Bus. Component Developer Java EE Test Set 1

Which is a valid EJB QL query?


Options are :

  • SELECT OBJECT(c) FROM Customer c
  • SELECT OBJECT(c) FROM Customer c WHERE c > 100
  • SELECT OBJECT(c) WHERE c.customerId > 100
  • SELECT c.customerId FROM Customer customer

Answer : SELECT OBJECT(c) FROM Customer c

Given the client code for an entity bean with a remote client view:

Object ref = context.lookup(customer;

CustomerHome home = (CustomerHome) PortableRemoteObject.narrow(ref,

CustomerHome.class);

Which two statements are true? (Choose two.)

A. A Customer entity instance has been created.

B. home refers to the entity object's local home interface.

C. CustomerHome directly or indirectly extends EJBHome.

D. home refers to the entity object's remote home interface.

E. CustomerHome directly or indirectly implements EJBHome.


Options are :

  • A,B
  • D,E
  • C,D
  • B,C

Answer : C,D

Which two statements about a client's reference to a session bean's remote home interface are

true? (Choose two.)

A. The reference can be passed as a method argument.

B. The reference provides the client with the IP address of the bean instance.

C. The reference provides the client with access to at least one create method.

D. A new home reference must be obtained for each new reference to a remote component

interface.


Options are :

  • A,C
  • B,D
  • A,B
  • A,D

Answer : A,C

310-091 Sun Certified Bus. Component Developer Java EE Test Set 10

Which two statements about session beans with a remote client view are true? (Choose two.)

A. The Bean Provider must implement the getEJBObject method.

B. The Bean Provider must create a class that implements EJBObject.

C. The Bean Provider is not responsible for implementing the handle classes.

D. The Bean Provider must guarantee that an ejbRemove method is implemented in the bean

class.

E. The Bean Provider is responsible for ensuring that only one thread can be executing an

instance at any given time.


Options are :

  • D,E
  • A,B
  • C,D
  • B,C

Answer : C,D

From the client's point of view, which two actions destroy an entity? (Choose two.)

A. a direct delete of the object's data in the persistent store

B. calling remove on the remote or local interface of the entity object

C. a crash of the Java Virtual Machine in which the entity bean instance executes

D. the client releasing all references to the entity object's remote and local interfaces


Options are :

  • B,C
  • A,C
  • A,B
  • B,D

Answer : A,B

Which pair of methods define a cmp-field called balance for a CMP 2.0 entity bean?


Options are :

  • public abstract double get_balance() public abstract void set_balance(double balance)
  • private abstract double getBalance() private abstract void setBalance(double balance)
  • public double getBalance() public void setBalance(double balance)
  • public abstract double getBalance() public abstract void setBalance(double balance)
  • private double getBalance() private void setBalance(double balance)

Answer : public abstract double getBalance() public abstract void setBalance(double balance)

310-091 Sun Certified Bus. Component Developer Java EE Test Set 2

Given a valid reference to a stateless session object remote home interface called paymentHome

and this client code:

7. try{

8. PaymentService pymt = paymentHome.create();

9. pymt.processPayment();

10. pymt.remove();

11. }

12. catch (javax.ejb.CreateException exc){

13. exc.printStackTrace();

14. }

Assume that the EJB remote component interface does NOT throw any application-specific

exceptions.

Which two additional exceptions does this code need to handle? (Choose two.)

A. javax.ejb.EJBException

B. java.rmi.RemoteException

C. javax.ejb.RemoveException

D. javax.ejb.FinderException


Options are :

  • A,B
  • B,C
  • C,D
  • A,D

Answer : B,C

Which two statements about session beans are true? (Choose two.)

A. A session bean class must extend javax.ejb.SessionBean.

B. A stateful session bean may have overloaded create methods.

C. Stateless session beans are not required to define a create method.

D. Stateless session beans are not allowed to have instance variable state.

E. A stateless session bean must not implement SessionSynchronization.

F. A Bean Provider must declare at least one remove method in the bean's component interface


Options are :

  • D,E
  • C,E
  • B,E
  • A,E

Answer : B,E

Which two transaction attributes are legal for the onMessage method of a message-driven bean?

(Choose two.)

A. Never

B. Supports

C. Required

D. Mandatory

E. NotSupported


Options are :

  • B,E
  • A,E
  • D,E
  • C,E

Answer : C,E

310-091 Sun Certified Bus. Component Developer Java EE Test Set 3

In a JNDI lookup, what does the java:comp/env prefix access?


Options are :

  • the server's JNDI namespace
  • the bean's private namespace
  • the EJBContext of the bean
  • the server resources

Answer : the bean's private namespace

What is allowed within a message-driven bean?


Options are :

  • accessing the java:comp/env namespace from within the ejbCreate method
  • throwing an application exception from the onMessage method
  • sending a JMS message from within the setMessageDrivenContext method
  • consuming a JMS message from within the setMessageDrivenContext method

Answer : accessing the java:comp/env namespace from within the ejbCreate method

Which two must a Bean Provider supply for each enterprise bean in the deployment descriptor?

(Choose two.)

A. security roles

B. the JNDI name of the enterprise bean

C. the enterprise bean type: session, entity, or message-driven

D. the value of the transaction attributes for the home and component interface methods

E. the fully-qualified name of the class that implements the enterprise bean's business methods


Options are :

  • A,E
  • B,E
  • C,E
  • D,E

Answer : C,E

310-091 Sun Certified Bus. Component Developer Java EE Test Set 4

Given the desired behavior:

(1) If a client calls without a transaction context, the container automatically starts a new

transaction before delegating the method call to the bean instance.

(2) If a client calls with a transaction context, the container invokes the bean in the client's

transaction context.

Which transaction attribute yields this behavior?


Options are :

  • Supports
  • Mandatory
  • RequiresNew
  • Required

Answer : Required

Which two statements describe a reason to use system exceptions? (Choose two.)

A. to guarantee that the EJB Container re-throws the exception to a client

B. to signal the EJB Container that an unexpected exception has occurred

C. to ensure that the EJB Container logs the exception produced by the EJB

D. to allow the EJB Container to commit a transaction if an exception occurs


Options are :

  • C,D
  • B,C
  • A,B
  • A,D

Answer : B,C

Which statement is true about the programmatic security method isCallerInRole?


Options are :

  • The method throws java.lang.SecurityException if invoked in methods where no security context exists
  • It tests whether the client is a member of the role specified in the argument to the method
  • The method tests the principal that represents the run-as security identity of the bean, if any.
  • The method tests whether the caller's role exists in the security domain.

Answer : It tests whether the client is a member of the role specified in the argument to the method

310-091 Sun Certified Bus. Component Developer Java EE Test Set 5

Which is a capability guaranteed by all EJB 2.0 containers?


Options are :

  • load balanservlet supportcing
  • JTA support
  • server failover
  • server clustering

Answer : JTA support

Which two must a Bean Provider avoid in an enterprise bean to ensure that the bean is portable to

any compliant EJB 2.0 container? (Choose two.) (Assume that all reference variables have been

correctly and legally initialized.)

A. java.sql.Connection c = aDataSource.getConnection();

B. java.security.Principal p =

context.getCallerPrincipal();

C. QueueSession q =

aQueueConnection.createQueueSession(true, 0);

D. Object o = new Object();

Object o2 = o.getClass().getClassLoader();

E. java.io.FileInputStream fs =

new java.io.FileInputStream("MyFile");


Options are :

  • A,B
  • B,C
  • C,D
  • D,E

Answer : D,E

Which action must the Bean Provider take before throwing an application exception from an entity

bean with the Required transaction attribute?


Options are :

  • call EJBContext.setRollbackOnly
  • log the exception
  • mark the bean instance for destruction
  • mark the transaction for rollback if there is an unrecoverable business logic failure

Answer : mark the transaction for rollback if there is an unrecoverable business logic failure

310-091 Sun Certified Bus. Component Developer Java EE Test Set 6

How can a CMP 2.0 entity bean retrieve its primary key?


Options are :

  • EntityBean.getIdentity()
  • EntityBean.getPrimaryKey()
  • EntityContext.getIdentity()
  • EntityContext.getPrimaryKey()
  • the primary key instance field on the bean class
  • only through the primary key get accessor method

Answer : EntityContext.getPrimaryKey()

Given :

6. <session>

18. <ejb-local-ref>

19. <ejb-ref-name>ejb/Certifier</ejb-ref-name>

20. <ejb-ref-type>Entity</ejb-ref-type>

21. <ejb-class>biz.cert.CertifyBean</ejb-class>

22. <local-home>biz.cert.CertifyLocalHome</local-home>

23. <local>biz.cert.CertifyLocal</local>

24. </ejb-local-ref>

25. </session>

Which statement is true about the <ejb-local-ref> tag, assuming the rest of the deployment

descriptor is valid?


Options are :

  • It is valid
  • It is invalid; the element should not be in the tag.
  • It is invalid; it is missing the required element.
  • It is invalid; the and elements should not be in the tag.

Answer : It is invalid; the element should not be in the tag.

Which deployment descriptor fragment is correct?


Options are :

  • admin
  • super-user
  • super-user
  • admin super-user

Answer : admin

310-091 Sun Certified Bus. Component Developer Java EE Test Set 7

A client obtains two entity object references from the same remote home. Which two are valid

tests to determine if the two object references refer to the same entity object? (Choose two.)

A. compare the object references with the == operator

B. compare the object references through the equals method

C. compare the object references through the isIdentical method

D. obtain the primary key from each object reference and compare them with the == operator

E. obtain the primary key from each object reference and compare them with the equals method

on the primary key class

F. obtain the primary key from each object reference and compare them with the isIdentical

method on the primary key class


Options are :

  • D,E
  • B,E
  • A,E
  • C,E

Answer : C,E

Which two are requirements for a CMP 2.0 entity bean? (Choose two.)

A. SQL code is abstracted into a data access object (DAO).

B. Persistent member fields must be declared as public in the bean class.

C. The bean class is declared as abstract and is extended by the container.

D. All interaction with the bean's persistent fields is done using abstract get and set methods


Options are :

  • C,D
  • B,D
  • B,C
  • A,B

Answer : C,D

Which two are true about a stateful session bean instance variable in order to ensure successful

passivation of the bean? (Choose two.)

A. It can be null.

B. It must not reference a UserTransaction.

C. It can reference a resource manager connection factory.

D. If it references a bean's remote interface, the stub must be serializable.


Options are :

  • A,C
  • B,C
  • B,D
  • A,B

Answer : A,C

310-091 Sun Certified Bus. Component Developer Java EE Test Set 8

A session bean implements the SessionSynchronization interface. Which two statements are true?

(Choose two.)

A. The container invokes afterCompletion to notify the bean instance of the transaction outcome.

B. The container invokes afterBegin when processing a begin call on the UserTransaction

interface.

C. The container invokes beforeBegin to notify the bean instance of an impending transactional

client call.

D. The container invokes getRollbackOnly to give the bean instance an opportunity to roll back the

transaction.

E. The container invokes beforeCompletion to give the bean instance the last chance to cause the

transaction to roll back


Options are :

  • A,B
  • A,E
  • A,C
  • A,D

Answer : A,E

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions