Two Laptop Bag*
The moose likes EJB and other Java EE Technologies and the fly likes Doubt in ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Doubt in ejb" Watch "Doubt in ejb" New topic
Author

Doubt in ejb

Brijesh shah
Ranch Hand

Joined: Mar 16, 2007
Posts: 90
Dear All;

Yesterday i went for an interview for the post of Java Programmer.In second round of

technical interview there were some questions in which i having some doubts so i am

mentioning that noted questions with options..

kindly let me know correct answers so my doubt gets cleared

1>What is the effect of adding the sixth element to a vector created in the folowing manner?
new Vector(5, 10);
IN THIS I THINK A SHOULD BE THE ANSWER...
A. nothing, the vector will have grown when the fifth element was added
b. the vector grows size to a capacity of 10 elements
c. An indexOutOfBounds exception is raised
d. The vector grows in size to a capacity of 15 elements

2>A System has a transaction manager, which manages transaction among multipe resources usin

the 2-PC protocol. During one such transaction using User Transaction, while trying to

commit data to one resource I got a Heruistic message.

A. The transaction managerhas decided not to commit data to the resource and hence sends

information back to the client saying that it(Transaction Manager) has taken a Heuristic

decision
B. The resource decides to commit data on its own without permission from the Trancsaction

Manager and informs the transaction manager that it(Transaction Manager)has taken a

Heuristic decision, which in turn inform the client.
C. The resource decides not to commit data by taking permission from the Transaction Manager

and informs the Transaction Manager that it(Transaction Manager)has taken a Heuristic

decision, which in turn inform the client.
D. The resource decides not to commit data without taking permission from the Transaction

Manager(Transaction Manager) and informs the transaction manager that it has taken a

Heuristic dexesion, which in turn inform the client.


Hope to hear from you soon.

Thanks & Best Regards,
Brijesh shah
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Please check with the javaranch's naming policy.

http://www.javaranch.com/name.jsp
[ June 23, 2007: Message edited by: Rahul Bhattacharjee ]

Rahul Bhattacharjee
LinkedIn - Blog
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
For the first question

public Vector(int initialCapacity,
int capacityIncrement)Constructs an empty vector with the specified initial capacity and capacity increment.

Parameters:
initialCapacity - the initial capacity of the vector.
capacityIncrement - the amount by which the capacity is increased when the vector overflows.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html

For the second question

Answer seems to be (B). But I am not sure

http://java.sun.com/j2ee/1.4/docs/api/javax/transaction/HeuristicMixedException.html


Amit Tank
Linked In
 
jQuery in Action, 2nd edition
 
subject: Doubt in ejb