[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-895 Dumps with VCE and PDF 31-40

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-895
100% Free Download! 100% Pass Guaranteed!

Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam

Question No: 31

Given two stateless session beans, ABean and BBean:

Ensurepass 2018 PDF and VCE

A client that is not executing within a transaction acquires an EJB reference to ABean and invokes the a() method on time. How many distinct transactions are started by the container after all processing has completed?

  1. 0

  2. 1

  3. 2

  4. 3

Answer: B

Explanation: Note: REQUIRED

If a client invokes the enterprise bean#39;s method while the client is associated with a transaction context, the container invokes the enterprise bean#39;s method in the client#39;s transaction context.

Reference: Enum TransactionAttributeType

Question No: 32

Given this code snippet from a JMS message driven bean class X:

Ensurepass 2018 PDF and VCE

When this bean class handles a message, which is correct?

  1. After a message delivery the result is 1.

  2. After a message delivery the result is 2.

  3. After a message delivery the result is 12.

  4. After a message delivery an exception is thrown.

  5. After a message delivery the result is unpredictable.

  6. This is NOT a compliant JMS message-driven bean.

Answer: F

Question No: 33

Which statement about message-driven beans is correct?

  1. Each message-driven bean instance will be invoked by only one thread at a time.

  2. When dispatching messages to message beam instances the container must preserve the order in which messages arrive.

  3. 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.

  4. 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.

Answer: A

Question No: 34

Given code snippets from two files:

Ensurepass 2018 PDF and VCE

Which four code changes, when used together, create a valid JMS message-driven bean? (Choose four)

  1. Make class MessageDog public

  2. Make the MessageDog constructor no-arg

  3. Make the MessageDog constructor public

  4. Move the onMessage method to class MessageDog.

  5. Change MessageDog so that it is NOT a subclass of Dog.

  6. Make class MessageDog implement MessageListner instead of MessageDrivenBean.

Answer: A,B,C,F

Question No: 35

Which is a valid Postconstruct method in a message-driven bean class?

  1. @PostConstruct

    public boolean init() { return true; }

  2. @PostConstruct private static void init () {}

  3. @PostConstruct private void init ()

  4. @PostConstruct public static void init () {}

Answer: C

Question No: 36

Which statement is correct about a Java EF client of a message driven bean?

  1. The client can use JNDI to obtain a reference to a message destination.

  2. The client can use JNDI to obtain a reference to a dependency injection.

  3. The client can use JNDI to obtain a reference to a message-driven bean instance.

  4. The client can use JNDI to look up a reference to the message-driven bean#39;s home interface.

Answer: A

Question No: 37

You are writing an EE component that functions as a message producer. The message producer sends message to a JMS queue. The component environment defines a resource-ref of type javax.jms.ConnectionFactory with the same jms/ConnectionFactory.

Which will correctly obtain a connection factory for a queue?

  1. Context context = new initialContext();

    Connectionfactory confac = (ConnectionFactory) Context.lookup (“java: comp/env/jms/ConnectionFactory”);

  2. InitialContext Context = new Context () ;

    QueueConnectionFactory confac = (QueueConnectionFactory) context.lookup (“java: comp/env/jms/Myfactory”);

  3. @Resource (“ConnectionFactory”)

    private static QueueConnectionFactory confac;

  4. @Resource (loopkup = “jms/QueueConnectionFactory”) private static ConnectionFactoryconfac;

Answer: D

Explanation: A connection factory is the object a client uses to create a connection to a provider. A connection factory encapsulates a set of connection configuration parameters that has been defined by an administrator. Each connection factory is an instance of theConnectionFactory, QueueConnectionFactory, or TopicConnectionFactory interface

At the beginning of a JMS client program, you usually inject a connection factory resource into a ConnectionFactory object. For example, the following code fragment specifies a resource whose JNDI name is jms/ConnectionFactory and assigns it to a

ConnectionFactory object:

@Resource(lookup = quot;jms/ConnectionFactoryquot;) private static ConnectionFactory connectionFactory;

Reference: The Java EE 6 Tutoria, The JMS API Programming Model

Question No: 38

You are writing a client that sends a message to a JMS queue. Which statement is true?

  1. You use a connection factory to create a session.

  2. When you create a session, you specify whether or not it is transacted.

  3. When you create a connection, you specify the acknowledgment mode.

  4. When you create a message producer, you must specify the name of the destination to which you will send messages.

Answer: A Explanation: Note:

The SimpleMessageClient sends messages to the queue that the SimpleMessageBean listens to.

The client starts by injecting the connection factory and queue resources:

@Resource(mappedName=quot;jms/ConnectionFactoryquot;) private static ConnectionFactory connectionFactory;

@Resource(mappedName=quot;jms/Queuequot;) private static Queue queue;

Next, the client creates the connection, session, and message producer: connection = connectionFactory.createConnection();

session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(queue);

Finally, the client sends several messages to the queue: message = session.createTextMessage();

for (int i = 0; i lt; NUM_MSGS; i ) { message.setText(quot;This is message quot; (i 1));

System.out.println(quot;Sending message: quot; message.getText()); messageProducer.send(message);


Question No: 39

Which two are true about the client view of a message-driven bean? (Choose two.)

  1. References to message destinations can be infected.

  2. References to message destinations cannot be looked up in the client#39;s JNDI namespace.

  3. Clients of a message destination need to know that the destination is listened to by a pool of message consumers,

  4. Clients of a message destination do NOT need to know that the destination is listened to by a message-driven bean.

Answer: B,C

Explanation: Client components do not locate message-driven beans and invoke methods directly on them.

Instead, a client accesses a message-driven bean through, for example, JMS by sending messagesto the message destination for which the message-driven bean class is the MessageListener.

Reference: The Java EE 6 Tutorial, What is a Message-Driven Bean?

Question No: 40

Given the following stateful bean:

  1. @Stateful

  2. @TransactionAttribute(TransactionAttributeType.SUPPORTS)

  3. public class VideoBean implements video {

  4. / / insert code here

  5. public void method () {}

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?

  1. @TransactionAttribute ()

  2. @transactionmanagement(TransactionAttributeType.CONTAINER)

  3. @TransactionAttribute(transactionAttributeType.MANDATORY)

  4. @transactionAttribute(TransactionattributeType.RECQUIRES_NEW)

Answer: C

100% Ensurepass Free Download!
Download Free Demo:1z0-895 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-895 Dumps

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.