• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

some mock questions..

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,

Can you please help me guiding correct answers to these questions.
And also see if what i thought was correct or incorrect.

The deployment descriptor for the Foo session bean looks similar to this:

10. <enterprise-beans>
11. <session>
12. ...
13. <ejb-name>Foo</ejb-name>
14. <ejb-class>ms.FooBean</ejb-class>
15. ...
16. <resource-ref>
17. <res-ref-name>jdbc/BarDB</res-ref-name>
18. <res-type>javax.sql.DataSource</res-type>
19. <res-auth>Container</res-auth>
20. <res-sharing-scope>Shareable</res-sharing-scope>
21. </resource-ref>
22. ...
23. </session>
24.</enterprise-beans>

Assume that a deployer binds this to an actual resource. The implementation of Foo contains a reference to a Context object bound to the variable initCtx and a reference to a SessionContext object bound to the variable ctx. Which statement successfully retrieves the datasource?

@Resource DataSource ds;
(DataSource) ctx.lookup("java:comp:env/jdbc/BarDB");
initCtx.lookup("java:comp/env/jdbc/BarDB");
@Resource(name=?jdbc/BarDB?, type=javax.sql.DataSource)

my ans:3
-------------------------------------------------------------------------

A developer is given a JMS message-driven bean, which has no descriptors or metadata that describe acknowledge modes or subscription durability. In addition, the message-driven bean uses bean-managed transactions and is subscribed to a topic.

What two message-driven bean behaviors can the developer expect to see? (Choose two.)

If a message is received, the container automatically acknowledges it.
If a message is received, the container does NOT automatically acknowledge it.
Messages will NOT be missed, even if the EJB server is NOT running.
Messages can be missed if the EJB server is NOT running.
Specifying subscription durability for a topic has no effect.

my ans: 1,4

--------------------------------------------------------------------------

Given an excerpt of a Book entity (it is just missing the import statements):


10. @Entity
11. public class Book implements Serializable {
12. @Id
13. @GeneratedValue(strategy = GenerationType.AUTO)
14. private Integer id;
15. String bookName;
16. protected int price;
17. enum Status {IN, OUT};
18. @Enumerated( EnumType.ORDINAL )
19. Status status;
20. transient int bar;
21. java.util.Map<Integer, String> comments;
22. protected Book() {};
23. }

No descriptors are used.

Which statement is correct about this entity?

There is an error on line 11. It must NOT implement Serializable.
Adding a single @Transient annotation makes this entity valid.
The visibility declarations on some of the variables causes an exception.
The enumeration or its field definition on lines 17, 18, or 19 is NOT valid.
There is an error in the identity definition on lines 12, 13, or 14.

My ans:"The visibility declarations on some of the variables causes an exception."
-----------------------------------------------------------------------


thanks,
mallika
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My answers are:
Q1: 3
Q2: 1, 4
Q3: 2

Meng Tan
 
This is my favorite tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic