• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Nice EJB Questions. Any Takers?

 
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everybody,
Here are some nice questions on EJB. Any takers?
(1)
Which one of the following patterns is realized by the EJB Home Interface?
1 Dispatcher
2 Factory
3 Builder
4 Proxy
5 Service Locator
=======
(2)
A Deployer created the following descriptor fragment for a message-driven bean:
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
Referring to the MDB deployment descriptor fragment from the scenario above, which one of the following statements correctly describes the MDB's features?
1 The MDB is a javax.jms.Topic producer that has a NonDurable subscription for one or more Topics.
2 The MDB is a JMS Publish-Subscribe producer that may lose its topic subscription after the EJB server is restarted.
3 The MDB is a javax.jms.Topic consumer that is removed after the EJB server is restarted.
4 The MDB is a JMS Publish-Subscribe consumer that may lose some messages if the EJB server goes down.
5 The MDB is a JMS Publish-Subscribe consumer that may lose its topic subscription if the EJB server goes down.
=======
(3)
<method-permission>
<role-name>reservationAgent</role-name>
<ejb-name>ReservationSession</ejb-name>
<method-name>reserveTrip</method-name>
<method-params>String</method-params>
</method-permission>
Referring to the sample deployment descriptor fragment above, which one of the following describes the results of the method-permission tag?
1 Any user from the group reservationAgent is allowed to call method reserveTrip in ReservationSession.
2 The user named reservationAgent is allowed to call the ReservationSession method reserveTrip with one String argument.
3 The principle associated with role reservationAgent is allowed to call method reserveTrip with at least one String argument in ReservationSession.
4 The user in role of reservationAgent is allowed to call any method called reserveTrip in ReservationSession.
5 The principle associated with role reservationAgent is allowed to call method reserveTrip with one String argument in ReservationSession.
=======
(4)
Which one of the following Enterprise Java Beans has an ejbCreate() method with NO arguments?
1 A BMP entity bean
2 A stateful session bean
3 A CMP entity bean
4 A session bean with bean-managed transaction
5 A stateless session bean
=======
(5)
Which one of the following statements correctly describes the differences between CMP and BMP entity beans related to finder methods?
1 CMP finders return an EJBObject or a Collection thereof. BMP finders return a primary key or a Collection thereof.
2 CMP finders return a primary key or a Collection of EJBObjects. BMP finders return a primary key or a Collection thereof.
3 CMP finders return only a Collection of EJBObjects. BMP finders return only a Collection of primary keys.
4 CMP finders return only a Collection of primary keys. BMP finders return only a Collection of EJBObjects.
5 CMP finders return a primary key or a Collection thereof. BMP finders return an EJBObject or a Collection thereof.
=======
(6)
What types of resources are part of the conversational state of a stateful session bean and are preserved by the container when the bean is passivated?
1 Database connections
2 Open files
3 URL connections
4 Open sockets
5 EJB context references
=======
(7)
How do you indicate the JNDI name for the "MyDataSource" database resource in a deployment descriptor?
1 <ref-name>jdbc/MyDataSource</ref-name>
2 <res-ref-name>jdbc/MyDataSource</res-ref-name>
3 <ref-name>MyDataSource</ref-name>
4 <resource-env-ref-name>MyDataSource</resource-env-ref-name>
5 <res-ref-name>java:comp/env/jdbc/MyDataSource</res-ref-name>
=======
(8)
What entity bean method do you use to uniquely identify the data represented by the bean in a persistent store?
1 getEJBMetaData()
2 getEntityContext()
3 getHandle()
4 getPrimaryKey()
5 getEJBObject()
=======
(9)
Which one of the following enterprise beans holds NO conversational state or persistent data?
1 BMP entity bean
2 Stateful session bean
3 CMP entity bean
4 Stateless session bean
5 Java bean
=======
(10)
You want to design an EJB that supports container-managed transactions and will be notified by its container at transaction boundaries (begin, commit, rollback). Which types of beans implement the above scenario using the SessionSynchronization interface?
1 Stateless session beans
2 CMP entity beans
3 Stateful session beans
4 BMP entity beans
5 Message-driven beans
=======
(11)
What security conditions must a caller principal meet in order to be allowed to perform an EJB method?
1 It must be assigned to exactly one of the security roles allowed to access the method.
2 It must be assigned to one of the security roles allowed to perform every method on the bean.
3 It must be assigned to all of the security roles associated with the method.
4 It must be assigned to at least one of the security roles associated with the method.
5 It must be assigned to all security roles allowed to access the method
=======
(12)
An EJB session bean needs to retrieve a JMS QueueConnectionFactory that is registered in JNDI under "java:comp/env/jms/QueueFactory". Referring to the scenario above, which one of the following correctly describes the related deployment descriptor entries?
1
<resource-ref>
<res-ref-name>jms/QueueFactory</res-ref-name>
<res-ref-type>javax.jms.QueueConnectionFactory</res-ref-type>
<res-auth>Container</res-auth>
</resource-ref>
2
<resource-ref>
<res-ref-name>java:comp/env/jms/QueueFactory</res-ref-name>
<res-ref-type>javax.jms.QueueConnectionFactory</res-ref-type>
<res-auth>Container</res-auth>
</resource-ref>
3
<resource-env-ref>
<resource-env-ref-name>jms/QueueFactory</resource-env-ref-name>
<resource-env-ref-type>javax.jms.QueueConnectionFactory
</resource-env-ref-type>
</resource-env-ref>
4
<resource-env-ref>
<resource-env-ref-name>java:comp/env/jms/QueueFactory
</resource-env-ref-name>
<resource-env-ref-type>javax.jms.QueueConnectionFactory
</resource-env-ref-type>
</resource-env-ref>
5
<resource-env-ref>
<res-ref-name>jms/QueueFactory</res-ref-name>
<res-ref-type>javax.jms.QueueConnectionFactory</res-ref-type>
</resource-env-ref>
=======
(13)
The EJB server manages some JMS-related objects so that the developer can register and retrieve them using JNDI. Referring to the scenario above, objects implementing which one of the following JMS interfaces are managed by the EJB server?
1 javax.jms.Queue
2 javax.jms.QueueSender
3 javax.jms.TopicConnection
4 javax.jms.QueueConnection
5 javax.jms.TopicSession
=======
(14)
Which one of the following beans allows a client to maintain a conversation across multiple calls?
1 Stateful session bean
2 CMP entity bean
3 Stateless entity bean
4 Stateless session bean
5 BMP entity bean
=======
(15)
In the session bean TestEJB, the Bean Provider uses the following code to explicitly test whether or not the caller is assigned to the "admin" security role:
ctx.isCallerInRole("admin")
Referring to the sample code above, how does the Bean Provider signal to the Assembler and Deployer that his code relies on the security role "admin"?
1
<security-role-ref>
<role-link>admin</role-link>
</security-role-ref>
2
<security-role-ref>
<role-name>administrators</role-name>
<role-link>admin</role-link>
</security-role-ref>
3
<security-role>
<role-link>admin</role-link>
</security-role>
4
<security-role>
<role-name>admin</role-name>
</security-role>
5
<security-role-ref>
<role-name>admin</role-name>
</security-role-ref>
=======
(16)
An EJB Client Application initiates a transaction, which is then propagated to an EJB method. During the method execution, a System Exception is thrown.
Referring to the scenario above, which one of the following statements describes how the EJB container handles the client-initiated transaction?
1
It marks transaction for rollback. Then, it rethrows javax.transaction.TransactionRolledbackException to remote clients or javax.ejb.TransactionRolledbackLocalException to local clients.
2
It attempts to commit the transaction. If not successful, it rethrows the java.rmi.RemoteException to remote clients or the javax.ejb.EJBException to local clients.
3
It marks the transaction for rollback. Then, it rethrows javax.ejb.TransactionRolledbackException to remote clients, or javax.transaction.TransactionRolledbackLocalException to local clients.
4
It rolls back the transaction. Then, it rethrows the java.rmi.RemoteException to remote clients or the javax.ejb.EJBException to local clients.
5
It attempts to commit the transaction. If not successful, it rethrows javax.transaction.TransactionRolledbackException to remote clients, or javax.ejb.TransactionRolledbackLocalException to local clients.
=======
(17)
You want to achieve the following EJB architecture goals:
A) Reduce the number of network calls and transactions
B) Encapsulate a cohesive set of entity beans
C) Enforce security efficiently
D) Decouple Presentation from the Business Logic Layer?
Referring to the scenario above, which one of the following design patterns achieves the EJB architecture goals listed?
1 Session Facade
2 Service Locator
3 Aggregate Entity
4 Proxy Object
5 Value Object
=======
(18)
What is the difference between entity bean home and select methods?
1
ejbHome methods can return primitive values or Collections thereof; ejbSelect methods cannot.
2
ejbHome methods are exposed to EJB clients through the Home interface; ejbSelect methods can only be used internally in the bean.
3
ejbHome methods can return EJBObjects or Collections thereof; ejbSelect methods can only return EJBLocalObjects and Collections thereof.
4
ejbHome methods can be invoked on a bean in a "pooled" state; ejbSelect methods can be invoked only on a bean in a "ready" state.
5
ejbHome methods can be invoked on a bean in a "ready" state; ejbSelect methods can be invoked only on a bean in a "pooled" state.
========
(19)
The Employer entity bean has a cmr-field employees for a many-to-many bidirectional relationship between EJB's Employer and Employee. You have two Employer beans, company1 and company2, each with its own set of employees.
Referring to the scenario above, which one of the following statements describes the result of executing the following code: "company2.addAll(company1.getEmployees());"?
1
All employees from company1 are moved to company2, overwriting company2 employees.
2
All employees from company1 are added to company2; they are now employed by both companies.
3
All employees from company1 are moved to company2; company1 employees are null.
4
The container throws a DuplicateKeyException because employees must not belong to two companies.
5
All employees from company1 are moved to company2; company1 employees is empty.
=======
(20)
What type of information is included in the <assembly-descriptor> element of a deployment descriptor?
1 Security role references
2 Resource manager connection factory references
3 Container-managed relationships
4 Environment entries
5 Method permissions
=======End==========
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debashish Chakrabarty:
(1)
Which one of the following patterns is realized by the EJB Home Interface?
1 Dispatcher
2 Factory
3 Builder
4 Proxy
5 Service Locator
=======


The GoF patterns (which is all that the exam covers) have two patterns: Abstract Factory, and Factory Method. The distinction is important, and would make the difference between getting the question right or wrong.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic