SUN 310-091 Exam Q&As, 100% Success Rate SUN 310-091 Exam Sample Will Be More Popular

You can pass SUN 310-091 exam if you get a complete hold of SUN 310-091 dumps. What’s more, all the SUN 310-091 Certification exams Q and A provided by Flydumps is the latest.

QUESTION NO: 1

Given the following stateful session bean:
10.
@Stateful

11.
@TransactionAttributefJransactionAttributeType. SUPPORTS)

12.
public class VideoBean implements Video {

13.
// insert code here

14.
public void methodAO {} 15.}
Assuming no other transaction-related metadata, which code can be added at Line 13 to guarantee that business method methodA will execute only if invoked with an active transaction?
A. @TransactionAttributefJ
B. @TransactionManagement(TransactionAttributeType. CONTAINER)
C. @TransactionAttribute(TransactionAttributeType. MANDATORY)
D. @TransactionAttributeO”ransactionAttributeType.REQUIRES_NEW)
Answer: C
QUESTION NO: 2
Given the following client-side code that makes use of the session bean Foo:
10.
@EJB Foo beanl;

11.
@EJB Foo bean2; //more code here
20.
booleantestl = beanl.equals(beanl);

21.
booleantest2 = beanl.equals(bean2);
Which two statements are true? (Choose two.)
A. If Foo is stateful, testl is true, and test2 is true.
B. If Foo is stateful, testl is true, and test2 is false.
C. If Foo is stateless, testl is true, and test2 is true.
D. If Foo is stateful, testl is false, and test2 is false.
E. If Foo is stateless, testl is true, and test2 is false.
F. If Foo is stateless, testl is false, and test2 is false.
Answer: B,C QUESTION NO: 3
Which statement about entity manager is true?
A. A container-managed entity manager must be a JTA entity manager.
B. An entity manager injected into session beans can use either JTA or resource-local transaction control.
C. An entity manager created by calling the EntityManagerFactory.createEntityManager method always uses JTA transaction control.
D. An entity manager obtained through resource injection in a stateful session bean can use a resource-local EntityTransaction for transaction control
Answer: A
QUESTION NO: 4
Which statement is true about the use of a persist operation in a transaction?
A. If a user persists a detached object it always becomes managed.
B. The persist operation on an entity always cascades to its related entities.
C. If a user persists a new entity with an existing primary key the transaction will fail.
D. If a user persists a managed entity an exception may be thrown by the persist operation.
Answer: C

QUESTION NO: 5
A developer writes a stateless session bean with one local business interface and with container- managed transactions. All business methods have transaction attribute REQUIRED. The bean has an injected field sessionCtx of the type SessionContext. Which two operations are allowed in a business method of the bean? (Choose two.)
A. sessionCtx. getEJBObject
B. sessionCtx.setRollbackOnly
C. sessionCtx. getMessageContext
D. sessionCtx. getBusinessObject
E. sessionCtx. getEJBLocalObject
Answer: B,D
QUESTION NO: 6
A developer implements a session bean with a method doStuff which behaves differently depending on the caller’s security role. Only users in security roles “ADMIN” and “USER” are allowed to call the method. Assume that there is no security-related metadata in the deployment descriptor. Which two, taken in combination, are appropriate to accomplish this? (Choose two.)
A. Annotate method doStuff with @PermitAII.
B. Annotate method doStuff with @RolesAllowed({“ADMIN”,”USER”})
C. If EJBContext.getCallerPrincipal returns role “ADMIN”, implement the behavior for users in role ADMIN.
D. If EJBContext.isCallerlnRole(“ADMIN”) returns true, implement the behavior defined for users in role “ADMIN”.
Answer: B,D

QUESTION NO: 7
Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int?
A. SELECT ANY(r. chairs) FROM Room r
B. SELECT NEW Integer(MAX(r. chairs)) FROM Room r
C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs)
D. SELECT c FROM Chair c WHERE LOCATE (c.type, lazyboy) > -1
Answer: B
QUESTION NO: 8
Given:
11.
.Entity public class X{

12.
@ld int id;

13.
Y y; 14.}
A public class Y with NO Java Persistence annotations is defined in the same package.
Which statement is correct about these classes if NO other annotations and mapping descriptors are provided?
A. Class Y must be serializable.
B. Class Y must be marked as an entity.
C. The entity X is not defined correctly.The field y must be marked as @Lob.
D. Class Y must be accessed by a persistence application through a public interface.
Answer: A
QUESTION NO: 9
A developer creates a stateless session bean. This session bean needs data from a remote system. Reading this data takes a long time. Assume that the data will NOT change during the lifetime of the bean and that the information to connect to the remote system is defined in JNDI. Which statement describes how to manage the data correctly?
A. Read the data in the bean’s constructor.
B. The data can only be read in the bean’s business methods.
C. Read the data in a method which is annotated with @PrePassivate.
D. Read the data in a method which is annotated with @Post Activate.
E. Read the data in a method which is annotated with (5)PostConstruct.
Answer: E

QUESTION NO: 10
An enterprise bean has security permissions set up using declarative security features. Under which two conditions can a client be guaranteed to have permission to invoke a business method on the enterprise bean? (Choose two.)
A. The Application Assembler has marked the enterprise bean method as unchecked.
B. The client’s principal has been assigned a security role with permission to invoke the method.
C. The Application Assembler has set the security-identity deployment descriptor to run-as.
D. The Application Assembler has mapped all security role references using the role-link element.
Answer: A,B

QUESTION NO: 11
An enterprise developer needs to modify the order of interceptor method execution specified by the Bean Provider, but does NOT have access to the bean’s source code. No deployment descriptor was provided in the ejb-jar delivered by the Bean Provider. Which represents the solution to this problem?
A. No solution is possible under these conditions.
B. The Deployer can add metadata annotations to the ejb-jar.
C. The Application Assembler can add metadata annotations to the ejb-jar.
D. The System Administrator can add interceptor binding information at runtime, using vendor- specific tools.
E. The Application Assembler can add a deployment descriptor to the ejb-jar that includes interceptor binding information.
Answer: E

QUESTION NO: 12
A developer writes a session bean which uses several configurable constants.
The constants are all defined as String types in JNDI. This cannot be changed because existing code is using the same JNDI information. One of the constants is a date, represented in string format. This date constant is used in multiple business methods of this session bean, actually as a Date object.
Converting strings to dates is an expensive operation; therefore, the developer wants to do as little converting as possible.
Which two scenarios can be used to prevent converting from String to Date in every business method? (Choose two.)
A. Load the date string in an instance Date type variable by annotation of the instance variable and let the container autoconvert it to a Date type automatically.
B. Load the date string in an instance String type variable by annotation of this instance variable and convert it to a Date type object in the beans constructor.
C. Load the date string in an instance String type variable by annotation of this instance variable and convert it to a Date type object in a @PostConstruct annotated method.
D. Load the date string in an instance Date type variable by annotation of a setter method that takes a String and which carries out the conversion and assigns the value to the instance variable.
Answer: C,D
QUESTION NO: 13
Which is a valid PostConstruct method in a message-driven bean class?
A. .PostConstruct
public boolean initQ {return true; }

B. .PostConstruct private static void init0 {}
C. .PostConstruct private void init0 {}
D. .PostConstruct public static void initQ {}
Answer: C
QUESTION NO: 14
A developer wants to create a JMS message-driven bean that responds to javax.jms.TextMessage messages. Which two statements are true? (Choose two.)
A. The developer must implement the ejbCreate method.
B. The developer does NOT need to create a business interface for the bean.
C. The developer must implement a method that declares javax.jms.TextMessage as an argument.
D. The message-driven bean class must implement methods of the javax.jms.MessageListener interface.
E. The message-driven bean class must implement methods of the javax. ejb. MessageDnvenBean interface.
Answer: B,D

QUESTION NO: 15
A Reader entity has a one-to-many, bidirectional relationship with a Book entity. Two Reader entities are persisted, each having two Book entities associated with them. For example, readeM has booka and bookb, while reader2 has bookc and bookd. Which query returns a Collection of fewer than four elements?
A. SELECT b.reader FROM Book b
B. SELECT r FROM Book b INNER JOIN b.reader r
C. SELECT r FROM Reader r INNER JOIN r.books b
D. SELECT r from Book b LEFT JOIN b.reader r LEFT JOIN FETCH r.books
Answer: C

QUESTION NO: 16
A session bean’s business method throws an exception during execution.
Which two are responsibilities of the Bean Provider when throwing the exception? (Choose two.)

A. For application exceptions, ensure that if the current transaction commits there will be no loss of data integrity.
B. For application exceptions, ensure that the current transaction will commit.
C. For system errors, when the client is remote, throw a java.rmi.RemoteException that wraps the original exception.
D. For checked exceptions from which the bean cannot recover, throw an EJBException that wraps the original exception.
Answer: A,D

QUESTION NO: 17
The ejb-jar file format is a contract between which two EJB role pairs? (Choose two.)
A. Deployer and System Administrator
B. Application Assembler and Deployer
C. Bean Provider and Application Assembler
D. Bean Provider and EJB Container Provider
E. EJB Server Provider and EJB Container Provider
F. Application Assembler and EJB Container Provider
Answer: B,C

QUESTION NO: 18
Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int?
A. SELECT ANY(r. chairs) FROM Room r
B. SELECT NEW Integer(MAX(r. chairs)) FROM Room r
C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs)
D. SELECT c FROM Chair c WHERE LOCATE (c.type, lazyboy) > -1
Answer: B
QUESTION NO: 19
A developer writes a stateful session bean called FooBean.
Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment dependency on a JMS Topic?
11.
public class FooBean {

12.

13.
public void fooQ {}

14.
15.}

A. @Resource(type=Topic. class)
B. @Resource(name=”topicRef) private static Topic topic;
C. .Resource private
D. .Resource private
Answer: C
QUESTION NO: 20
A developer has created an application-managed entity manager. Which statement is correct?
A. .Resource private .Resource private
B. A new persistence context begins when the entity manager is created.
C. A new persistence context begins when a new JTA transaction begins.
D. A new persistence context begins when the entity manager is invoked in the context of a JTA transaction.
E. A new persistence context begins when the entity manager is invoked in the context of a resource-local transaction.
Answer: A

SUN 310-091 only advanced and equipped with much more features,it is also not internet dependent,once installed.It enables you to see Interconnecting Cisco Networking Devices in a simulated SUN 310-091 exam environment.Working with SUN 310-091 Interactive Testing Engine is like passing an actual SUN 310-091 exam.

  •  
  •  
  •  
  •  
  •