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

Given:

public void setSessionContext (javax.ejb.SessionContext ctx)

{

context=ctx;

}

Assuming a stateless session bean, with container-managed transaction demarcation, which

method can be performed in the setSessionContext method?


Options are :

  • context.lookup("java:comp/env/jdbc/orders");
  • context.getEJBHome();
  • context.setRollbackOnly();
  • context.getEJBObject();

Answer : context.getEJBHome();

Which method can be invoked by a message-driven bean with container-managed transaction

demarcation?


Options are :

  • getCallerPrincipal
  • getUserTransaction
  • isCallerInRole
  • getRollbackOnly

Answer : getRollbackOnly

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

Which two Java data types are allowed as data types for an environment entry value? (Choose

two.)

A. float

B. java.util.Date

C. java.lang.String

D. java.lang.Integer


Options are :

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

Answer : C,D

Which statement about primary keys and object identity is false?


Options are :

  • The Bean Provider can retrieve the primary key by using the findByPrimaryKey method
  • The primary key must be a legal RMI-IIOP value type.
  • If two entity objects have the same home and the same primary key, they are considered identical.
  • A client can determine if two entity objects from the same home refer to the same entity by comparing their primary keys using the equals method.
  • Multiple entity beans can use the same primary key class

Answer : The Bean Provider can retrieve the primary key by using the findByPrimaryKey method

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
  • RequiresNew
  • Mandatory
  • Required

Answer : Required

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

You have a stateless session bean with container-managed transaction demarcation. Which two

methods can be invoked only after execution of the setSessionContext and ejbCreate methods

completes? (Choose two.)

A. context.getEJBHome()

B. context.getRollbackOnly()

C. context.getEJBLocalHome()

D. context.getUserTransaction()

E. context.getCallerPrincipal()


Options are :

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

Answer : B,E

Which is a valid equality comparison in EJB QL?


Options are :

  • comparing a cmp-field of type java.lang.String to an input parameter of type int
  • comparing a cmp-field of type java.lang.Boolean to a cmp-field of type java.lang.Integer
  • comparing entity objects of different abstract schema types that have the same primary key class
  • comparing a cmp-field of type java.lang.Float to an input parameter of type double

Answer : comparing a cmp-field of type java.lang.Float to an input parameter of type double

Given the desired behavior:

(1) If a client calls without a transaction context, the container invokes the bean in an unspecified

transaction context.

(2) If a client calls with a transaction context, the container suspends the association of the

transaction context with the current thread before invoking the enterprise bean's business method.

Which transaction attribute yields this behavior?


Options are :

  • NotSupported
  • Supports
  • Never
  • Required

Answer : NotSupported

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

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,F
  • B,E
  • A,E
  • C,E

Answer : B,E

Which statement is true about the EJBContext.setRollbackOnly method in EJB 2.0?


Options are :

  • There is no such method (setRollbackOnly) in the EJBContext interface.
  • This method may be invoked only within methods executing with a Supports transaction attribute.
  • Beans with bean-managed transactions are not allowed to use this method
  • Entity beans with container-managed transactions are not allowed to use this method.

Answer : Beans with bean-managed transactions are not allowed to use this method

Which two actions are appropriate if an enterprise bean's business method is remotely invoked by

a client? (Choose two.)

A. The container should propagate an application exception to the client.

B. The container should discard the bean instance for an application exception.

C. The client should handle the javax.ejb.EJBException, if thrown by the container.

D. The Bean Provider should propagate a java.lang.RuntimeException to the container


Options are :

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

Answer : A,D

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

Which type of deployment descriptor element would a Bean Provider use to locate a JMS Queue

through JNDI?


Options are :

  • environment entry
  • message-driven destination
  • resource manager connection factory
  • resource environment reference

Answer : resource environment reference

Which is an EJB application exception?


Options are :

  • javax.ejb.ObjectNotFoundException
  • javax.ejb.EJBException
  • javax.ejb.NoSuchEntityException
  • java.lang.RuntimeException

Answer : javax.ejb.ObjectNotFoundException

If an enterprise bean class implements the SessionSynchronization interface, which transaction

attribute is the Application Assembler permitted to use for the methods?


Options are :

  • Never
  • Supports
  • Unknown
  • RequiresNew
  • Not Supported

Answer : RequiresNew

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

Which statement about the EJB 2.0 container's role in passivating session beans is true?


Options are :

  • The container cannot remove a bean that is in a passivated state.
  • The container must call a stateless session bean's ejbPassivate method before sending the bean to the method-ready pool
  • The container must be able to save and restore a bean's reference to a java:comp/env JNDI context across the bean's passivation and activation
  • The container must use Java Serialization to passivate a bean

Answer : The container must be able to save and restore a bean's reference to a java:comp/env JNDI context across the bean's passivation and activation

Which is a method declared in javax.ejb.EJBLocalHome?


Options are :

  • getEJBMetaData()
  • getHomeHandle()
  • remove(Object primaryKey)
  • ejbCreate()

Answer : remove(Object primaryKey)

Which statement is true about BOTH stateful session beans and stateless session beans?


Options are :

  • The container passivates them using the ejbPassivate / ejbActivate methods
  • Any bean instance must be able to handle concurrent invocations from different threads
  • Bean instances are not required to survive container crashes
  • A bean with bean-managed transactions must commit or roll back any transaction before returning from a business method.

Answer : Bean instances are not required to survive container crashes

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

Which exception can be thrown when a session bean calls a business method of an entity bean

using the entity bean's local component interface?


Options are :

  • javax.ejb.EJBException
  • javax.transaction.TransactionRequiredException
  • java.rmi.RemoteException
  • javax.transaction.TransactionRolledbackException

Answer : javax.ejb.EJBException

Which is a Deployer's security-related responsibility?


Options are :

  • declaring the security-role elements in the deployment descriptor
  • declaring the method-permission elements in the deployment descriptor
  • assigning principals to security-role elements in the deployment descriptor
  • providing deployment tools

Answer : assigning principals to security-role elements in the deployment descriptor

Given the following business method of a remotely called stateful session bean:

42. public void overPerform(){

43. // Code to perform business operation

44. }

Which exception can be thrown directly from the bean method?


Options are :

  • javax.ejb.EJBException
  • javax.ejb.RemoveException
  • javax.ejb.ObjectNotFoundException
  • javax.ejb.CreateException

Answer : javax.ejb.EJBException

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

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 :

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

Answer : C,E

Given:

10. void setEntityContext(EntityContext context) {

11. // insert code

12. }

Which two are valid if inserted at line 11? (Choose two.)

A. context.getEJBHome();

B. this.id = (String) context.getPrimaryKey();

C. this.principal = context.getCallerPrincipal();

D. Context ctx = new InitialContext();

this.minBalance = (Double) ctx.lookup("java:comp/env/minBalance");


Options are :

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

Answer : A,D

Which two statements are true? (Choose two.)

A. The EJB container must not allow the same enterprise bean to be deployed multiple times.

B. The EJB container must allow IIOP invocations on remote component and home interfaces.

C. The EJB container is not required to support publishing home references in a CORBA

CosNaming service.

D. The EJB container must implement the resource manager connection factory classes for

resource managers configured with the container.

E. The EJB container must allow enterprise beans deployed in the same enterprise archive to

access one another directly without having to go through home or remote interfaces.


Options are :

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

Answer : B,D

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

Which two are required to properly implement a CMP entity bean class? (Choose two.)

A. Declare variables for all persistent fields.

B. Provide constructors to initialize the CMP fields.

C. Do not implement the ejbFind<METHOD> methods.

D. Provide implementation code for get and set methods to store and retrieve the persistent fields.

E. Implement ejbCreate<METHOD> methods for all home interface create<METHOD> methods.


Options are :

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

Answer : C,E

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 invalid; the and elements should not be in the tag.
  • It is valid.
  • It is invalid; it is missing the required element
  • It is invalid; the element should not be in the tag.

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

Which accurately describes a characteristic of EJB 2.0?


Options are :

  • EJB 2.0 is an example of a web-based component model
  • EJB 2.0 applications can link to legacy systems using a J2EE connector.
  • EJB 2.0 is an example of a component model for GUI applications
  • EJB 2.0 components must be directly accessible via HTTP.

Answer : EJB 2.0 applications can link to legacy systems using a J2EE connector.

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

What are two features of the transactional support in Enterprise JavaBeans? (Choose two.)

A. nested transactions

B. automatic propagation of transactional context

C. integration with the Java Transaction API (JTA)

D. automatic detection of necessary isolation level

E. automatic rollback of stateful session bean state


Options are :

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

Answer : B,C

Which statement correctly identifies the level of responsibility associated with managing

environment entries?


Options are :

  • The Deployer must ensure that all entries have valid values
  • The Deployer must ensure that all entries have valid values
  • The System Administrator must set values for all entries
  • The Bean Provider must set values for all entries

Answer : The Deployer must ensure that all entries have valid values

Which statement is true about <ejb-ref> and <ejb-local-ref> elements used to declare EJB

references?


Options are :

  • EJB references can be defined within the assembly portion of the EJB deployment descriptor
  • Both elements require the tag.
  • Every element requires an element
  • Every element requires the element

Answer : Both elements require the tag.

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

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 :

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

Answer : SessionSynchronization.afterCompletion

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions