Win a copy of Spark in Action this week in the Open Source Projects forum!

prat de

+ Follow
since Sep 15, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by prat de

what exactly is the difference between usage of local & remote interface ?
it seems that the explanation given in HF EJB was not sufficient enough to convince the interviewer.....can anyone please explain it with some example.
- prat
what happens when changes are made to the generated servlet (JSP converted to servlet).
This was asked to me in an interview recently....
please let me know the answer to the above question...
Thanks in advance.
- prat
16 years ago
please do share ur answers/opinions regarding foll. questions:
Q. Which statement is true about the JSP code below?
FileWriter fr=new FileWriter(targetFile,true);
fr.write("Some message");
catch(IOException ioex){}%>
a. That is not JSP
b. It should throw ServletException, not IOException
c. Code executes fine
d. FileWriter cannot be used on server
Q. What is the key difference between using a <jsp:forward> and HttpServletResponse.sendRedirect()?
a. forward executes on the client while sendRedirect() executes on the server.
b. forward executes on the server while sendRedirect() executes on the client.
c. both execute on the server.
d. both execute on the client.
Q. You have a .jsp page with an included file (myPage.jsp, with <%@ include file = 'includedFile.jsp'> . When you delete or modify the included file on the server, the old one may still shows in the browser. This can be resolved by -
a. restarting the server.
b. deleting the generated servlet.
c. manually refreshing/reloading the whole page (i.e. refresh 'myPage.jsp')
d. not possible to resolve.
Q. Read the code below.
public int doStartTag(){
JspWriter out=pageContext.getOut();
HttpSession session=pageContext.getSession();
session.setAttribute("TestValue","Hi there");
String s=(String)session.getAttribute("TestValue");
out.println("" + s);
What will be the result if this code is executed?
a. It prints 'Hi there'
b. It prints blank
c. It prints 'Hi'
d. It will not compile as HttpSession is an abstract class
Q. Which of the following statements are true ?
Each time the server receives a request for a servlet, the service method is called.
1. TLD tags never have dashes.
2. Overriding the service method should always be done.
3. A servlet cannot have more than 256 init parameters.
a. 1
b. 2 and 3
c. 3
d. 3 and 4
- prat.
16 years ago
please share ur answers/opinions regarding foll questions:
Q. Which of the following will not get the data from the first column of ResultSet rs, returned from executing the following SQL statement: “SELECT name, rank, serialNo FROM employee”

a. rs.getString(0);
b. rs.getString("name");
c. rs.getString(1);
Q. Which of the following statements about Transactions are true ?
a. A database does not support Transaction. In such a scenario, it is still possible to control transactions using JDBC API.
b. It is possible to set Transaction Isolation levels on the Statement object if we want the Statement to execute within a Transaction.
c. Assigning the CONCUR_UPDATEABLE property to ResultSet offers the highest level of concurrency.
d. It is possible to specify the database table index which should be used in a JDBC statement through hints.
- prat.
a tricky question:
(Please do share ur answer/opinions)
Q. Read the code below.
public interface A
public abstract void someMethod() throws Exception;
Any Class implementing this interface should -
a. necessarily be an abstract class.
b. have the method public abstract void someMethod().
c. have the method public void someMethod() throw an exception which is a subclass of java.lang.Exception.
d. have the method public void someMethod(), which need not throw an Exception.
my answer: C,D but one of my friends suggest B,C,D is it correct???
- prat.
please so share your answers/opinions regarding foll questions:
Q. Which of the following are true regarding Stateful Session beans?
a. Stateful Session beans can not have more than one ejbCreate methods
b. Stateful session beans serve only one client at a time
c. Stateful session beans can remember anything from the previous business method call
d. Stateful session bean can interact with any database using JDBC
e. In the ejbPassivate method of a Stateful session bean, we should release any resources a bean may be holding.
Q. Assume an Entity Bean ‘AccountBean’ with Remote Interface ‘Account’, Home Interface ‘AccountHome’ and Primary Key Class ‘AccountPK’. What should the return value of the ejbCreate() signature in AccountBean be ?
Q. Following are some statements about Message-driven beans.
1. A message-driven bean does not have a remote or home interface.
2. A message-driven bean can have only one business method.
3. A message-driven bean can send error messages to clients through Exceptions defines in the JMS API only.
4. A message-driven bean can be stateful or stateless.
5. A message-driven bean can find out the security identity of the message producer through deployment descriptor.
Which of the following combination is false?
a. 3, 4 and 5
b. 1, 4 and 5
c. 1, 3 and 4
d. 1, 3 and 5
e. 2, 3 and 5
Q) The transaction setting attribute for a bean is ‘Required’ in the Deployment Descriptor. A client calls this bean without starting its own transaction. Which of the following will occur ?–
a. The bean will start its new transaction and the transaction context will be returned to the client. The client now continues to execute in this Transaction Context.
b. The bean will start its new transaction but the transaction context will end when the beans business method ends its execution.
c. The bean will run without a transaction
d. An Exception will be thrown because the client called the bean without creating it’s own transaction
Q. Which of the following statements about EJB Deployment Descriptor are false?
a. Deployment Descriptor is used by containers to learn about various bean attributes like transactional characteristics, access control etc.
b. Deployment Descriptors, since they are in XML format are best suited for transporting enterprise beans back and forth between various systems.
c. Relationships between Entity Beans are stored in Deployment Descriptors.
d. EJBQL statements are written in Deployment Descriptors and not in the Entity Bean Java files.
- prat.
my interpretation:
these are the foll two ways a bean can pass a reference of itself to some other bean:
1. passing a "this" reference
2. passing the EJBObject reference obtained from Session/Entity Context.
It may be a bad idea to use the "this" variable within EJBs - the instance of the bean associated to Entity or Session object could change but this is one of the ways we can pass a reference whether it is practically not advisable is second i right...if incorrect please do correct me...
I am studying fro SCBCD and my target to complete the exam within another 5 weeks.
A Car can have four wheels. If a Car is deleted, then the Wheels objects are also deleted.
Class Car
private Wheel wheels[4];// One instance of Car has an array of Wheel objects
Class Wheel
private int wheelNo;
how the get a handle and pass to some other bean that's what i wanted to know, is it either by
passing a ‘this’ variable or passing a reference to the Home interface for the bean or passing a reference to the Remote interface for the bean
or by passing its Home Interface name.
how exactly I should do it.
- prat
"If a Car is deleted, then the Wheels objects are also deleted."
the above statement is a condition given to define a relationship between a Car and Wheel class. what u say is practically & logically correct but let us assume that this statement is a requirement and instead of challenging it we r going to implement it.
my perspective: composition (according to Fowler, a tighter from of aggregation is composition when whole is deleted, parts are also deleted...cascade delete).
your perspective please.
orderid, customerid are PK.
SELECT order.orderid, customer.customerid,, customer.address1, customer.address2,, customer.state,, customer.pincode, customer.totalsales
FROM customer, order
WHERE order.customerid = customer.customerid
AND customer.customerid > 10 and customer.customerid < 20000
AND order.status = 'CLOSED'
which part of the query / which operation takes max time of execution?
- prat.
16 years ago
how can a bean pass a reference of itself to some other bean?
- prat
A Car can have four wheels. If a Car is deleted, then the Wheels objects are also deleted.
One instance of Car has an array of Wheel
what is the relationship between these two classes?
i am little bit confused whether aggregation or composition??

thanks for your replies
modifying the question:
Class A
public void someMethod() throws InvalidCustomerException
Class InvalidCustomerException
is it still a dependency relationship or what exactly???
this was a question asked in my last interview.
- prat.
16 years ago