GeeCON Prague 2014*
The moose likes Servlets and the fly likes Help A Student With Some Interview Questions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Help A Student With Some Interview Questions?" Watch "Help A Student With Some Interview Questions?" New topic
Author

Help A Student With Some Interview Questions?

Navin Pillu
Ranch Hand

Joined: Apr 19, 2005
Posts: 103
Hi All

I've some interview question. Please send answer if anybody knows this.

1. what is servlet context and what it takes actually
as parameters? (other than from .xml file)

2. can we call destroy() method on servlets from
service method?

3. is there any difficulty of using the vector class
within a servlet class

4. what are the parsers and how can you use them in
your application?

5. is there any other immutable object other than
string?

6. how you are implementing multithreading concept in
fourth driver?

7. what are the advantages of doget() method?

8. when the servlet is going to initialize first time?

9 how to avoid deadlock situation?(other than singleton)

10. how to identify and remove the duplicate values in
an array?

11. if a system exposes bussiness API's to a client -
then what pattern it is using?
a) data access object.
b) value object.
c) business delegate.

12. What is threadsafe,class variable, instance variables? What is the difference in that

Thanks in Advance

[ May 25, 2005: Message edited by: Gregg Bolinger ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

First of all, what are your answers?
avaya sahu
Greenhorn

Joined: Oct 16, 2001
Posts: 14
Hi,

1. what is servlet context and what it takes actually
as parameters? (other than from .xml file)

Ans: Servlet container takes care of it. I don't know how it is created. pls. let me know if u get any ans to this question.

2. can we call destroy() method on servlets from
service method?


Ans: yes. it is like any otehr method. But it will not deregister the servlet. if you have any code which do some cleanup then it will lead the servlet to unstable state.

3. is there any difficulty of using the vector class
within a servlet class

Ans: No, but if you are using it as instance variable it will degrade the performace as vector is thread safe.


4. what are the parsers and how can you use them in
your application?
Ans: XML -> sax, pull, dom

java parser: Antlr, YMCC

5. is there any other immutable object other than
string?

Ans: don't know, let me know if there is any.

6. how you are implementing multithreading concept in
fourth driver?

Ans: which 4rth driver is not multithreaded?

7. what are the advantages of doget() method?

Ans: can be invoked directly by passing query string. Is useful for invoking resource through hyper link

8. when the servlet is going to initialize first time?

Ans: At startup and only once

9 how to avoid deadlock situation?(other than singleton)

Ans: singleton is not for avoiding deadloc.

10. how to identify and remove the duplicate values in
an array?

Ans: iterate through entire list and compare each one with other to find duplicate. use 2 for loop for this.


11. if a system exposes bussiness API's to a client -
then what pattern it is using?
a) data access object.
b) value object.
c) business delegate.

Ans : c) business delegate.

12. What is threadsafe,class variable, instance variables? What is the difference in that
Akilan IrudayaRaaja
Greenhorn

Joined: Oct 12, 2003
Posts: 6
5. is there any other immutable object other than
string?


I believe , all the wrapper classes Interger,Double,etc.. are immutable.

Thanks
Akilan
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I can't believe people have actually posted answers to this post.

First the apparent lack of work done by the poster, and second do you really want this guy to get a job where this knowledge is required? Maybe he'll get put on a project with you then you can continue to do his work for him.

Note, this is for an interview! It's people like this that give IT a bad name and make it harder for really qualified people to get work.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

I agree, the interview questions look like a person who created them had no idea about interviwing process and what (s)he is looking for.

1. what is servlet context and what it takes actually
as parameters? (other than from .xml file)

I have no idea what's relation servlet context with .xml and why knowledge of that so important.

2. can we call destroy() method on servlets from
service method?

Again pointless question. Maybe it pretendent to be tricky one? Who knows.

3. is there any difficulty of using the vector class
within a servlet class

Hmm. Probably author of this question has?

4. what are the parsers and how can you use them in
your application?

It's difficult to say what an author of this question meant. I'd answer as a parser for parsing streamable data, for example StringTokenizer.


5. is there any other immutable object other than
string?

It's funny. Some interviewer asked me, is String really immutable? When I answered yes, he had happiest face I ever seen, becasue he read java.programmer news group and found a trick allowing to change String content without a creation new object. Based on that I'd answer, yes, just pick any.

6. how you are implementing multithreading concept in
fourth driver?

I do not implement any fourth drivers.

7. what are the advantages of doget() method?
No advantages against any other methods. I believe an authour thought about advantages of implementation put method of http protocol.

8. when the servlet is going to initialize first time?
Probably the best question in the list.

9 how to avoid deadlock situation?(other than singleton)
No comments. An authr has no idea (s)he's asking.

10. how to identify and remove the duplicate values in
an array?

I'd say do not allow them to be there.

11. if a system exposes bussiness API's to a client -
then what pattern it is using?
a) data access object.
b) value object.
c) business delegate.

The question supposes to check knowledge of design patterns, but does it really do that?

12. What is threadsafe,class variable, instance variables? What is the difference in that
What's right answer? Atomic volatile? Or Author though about threadsafe access?


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'm still waiting to see feedback from the original poster
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Drog, that's a very intriguing remark about String mutability... could you please hint how it's done (unless of course it's a JNI trick) ?

Thanks
Chandu Dharmadhikari
Ranch Hand

Joined: Jan 22, 2005
Posts: 35
Hi Everybody

I read all postings. But what I think is nobody should dominate other like this. He might be new in this field. Thats why he asked such questions. The purpose of this forum (might be) to solve problems (& may be not to dominate other).
So please don't dominate others

Dear Navin first try to find out answers yourself.

Regards
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Originally posted by Sol Mam-Orn:
Drog, that's a very intriguing remark about String mutability... could you please hint how it's done (unless of course it's a JNI trick) ?

Thanks


Using reflection you can modify the underlying char[]. You can also use reflection to change a final variable. This is a bit dependant on what version of Java you are using and what, if any, security manager is in place.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Nothing to add, thanks Steven.
Suman Sarker
Ranch Hand

Joined: May 06, 2004
Posts: 68
Originally posted by Chandu Dharmadhikari:
He might be new in this field. Thats why he asked such questions. Dear Navin first try to find out answers yourself.



So, you expect the beginners to start with interview questions first? And, you advise them to find out the answers of those questions by themselves?


Suman A Sarker<br />SCJP, SCWCD, SCBCD<br /> <br />If You Can't Beat Them ... Join Them!
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

It's a good practice to be trained on common interview questions. Some people have a big success in that, when you read resume of person who jumped every 6 months from one big company to another. The problem is that big companies usually have very formalized interviewing process, so it isn't a big deal to figure how it works.

A bit off topic, I'd rather to have a separate forum My interview questions. It's a complex process to create really good interview questions, so it's helpful to exchange experience in this process. Currently, I do submit resume to any possible employer just to collect interview questions I can use later. Unfortunately many companies are lacking in good questions, how it was illustrated by original author of the thread.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

All of my posts were supposed to hint that providing answers may be premature at the moment.

At the JavaRanch we prefer to teach or help people find the answers rather than handing the answer over. We also only have the poster's word that these are related to an interview and not homework - we don't do homework and if you provide anseers to homework assignments your post will probably be deleted.

Maybe I'm just being over-cautious in this case, but I'm wary of posters who ask a large list of questions with no answers and then never show up again.
Suman Sarker
Ranch Hand

Joined: May 06, 2004
Posts: 68
Originally posted by D Rog:
It's a good practice to be trained on common interview questions.


Ofcourse, there is no harm in familiarizing oneself with interview questions but I dont think it's a good idea to do that before understanding the subject matter.
Navin Pillu
Ranch Hand

Joined: Apr 19, 2005
Posts: 103
Hi All

This is Navin. I'm a college student. These are the questions asked me in viva. I couldn't find answers for this, may be due to wrong (or triky) questions.

But people like you dicouraged me. I'll never post anything on this forum again. I'm a college student i mean i'm in the learning phase. And all of you, are professionals. That's why you are shouting at me like this. i'll also become a professional, but this is not a way to explain any thing to student.

I request you please cancel my registration. This is my last posting.

Thanks for your kind reply and good bye forever.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Then you probably won't return so we can reply, but here it is anyway.

Nowhere in your original post did you mention where the questions came from or why you could not answer them, or that you were a student.

We're an extremely friendly bunch here at the Ranch and no-one shouted at you. If you're going to be that sensitive the internet may not be the place for you, there are far far worse places than this site. However, we prefer to assist in the learning process and try not to hand out answers without knowing whether it's an honest question (like yours) or a homework assignment.

Some of the initial posts would have been out of place and you would have received an appology if you had explained your postition as a student, but you prefer to storm off and slam this door shut. From our position we couldn't tell the difference between asking an honest question or doing someones work for them, so the posts remained.

If you decide to return to the Ranch you will be welcomed, if not I offer you our best wishes in future, but please try not to be so sensitive.

Thanks for creating some discussion though,
Dave.
[ May 25, 2005: Message edited by: David O'Meara ]
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Hi Navin,

Just wanted to tell you, I am also a student. I have been a member here for a year and a half, and in my experience, the members here who have knowledge have been nothing but helpful. Maybe you didn't realize it, but to a native English speaker, the words "Answers expected" at the end of a query cause an extremely negative reaction. I don't know if you meant it that way, but for our (or at least my) ears, it sounds like a demand.

Noone here is shouting at you, we just find it inappropriate for you to just post a long list of questions and demand answers. You say that you will also become a professional; My advice to you would be to act like it. You will never learn the skills to become a professional by demanding others to do your work.

I think if you were to adjust your approach, and stay with JavaRanch, you will also make positive experiences with the people on this board.
Navin Pillu
Ranch Hand

Joined: Apr 19, 2005
Posts: 103
Hi All

Now I realized my mistake. My approach was wrong. It was a bit confusing. I'm extreamly sorry for that.

Thanks everybody for changing my mind.


Devaki Nihar
Greenhorn

Joined: Apr 30, 2005
Posts: 20
Thats the spirit Navin.
Believe me this forum is the best amoung all the java forums.
I learned a lot from this forum.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I think the first response (by David O'Meara) is the most appropriate.

What have you come up with so far?
If nothing, where have you looked?
What keywords did you try in any Google searches?

Don't try to deal with the whole list. Pick one or two (if related) issues and start there.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

By the way:
It's not too late to change the text in the subject of this thread
[ May 25, 2005: Message edited by: Ben Souther ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Ben Souther:
By the way:
It's not too late to change the text in the subject of this thread

[ May 25, 2005: Message edited by: Ben Souther ]


I helped him out with that.


GenRocket - Experts at Building Test Data
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I don't know...looks like that Navin dude might have just been pulling everyone's leg...
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by Stephen Huey:
I don't know...looks like that Navin dude might have just been pulling everyone's leg...


I don't think so. English is a funny language, and when it might not be your first language, you might say something offensive, when you don't mean to.

I think Navin is sincere.

Navin, what is Viva?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Originally posted by Mark Spritzler:

Navin, what is Viva?


Its an oral examination. No, not a visit to your dentist!! Its an interview of sorts that is part of your grade on the course. IMHO the original poster has already had the exam and was curious to know the answers to some of the questions. Memory being a funny jumbler, especially of concepts you do not understand, some of the questions came out sounding arbitrary.

Navin - as others on the Ranch have pointed out, do make an effort to find the answers before posting and you will find a lot of knowledge here!

Just my $.02,
Sharad


Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Kevin Alterman
Greenhorn

Joined: May 21, 2005
Posts: 12
If this is the quality of the questions being asked please let me know which company it is because I will make note to never interview there.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Originally posted by Mark Spritzler:

Navin, what is Viva?

Mark


An oral exam. viva voce at dictionary.com.

It is a commonplace phrase in the Indian education system.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by java whz:
If this is the quality of the questions being asked please let me know which company it is because I will make note to never interview there.


Kevin, it wasn't a job interview. It was a school course. We didn't understand that in the beginning, but now it has been cleared up.

Mark
 
GeeCON Prague 2014
 
subject: Help A Student With Some Interview Questions?