What will I wear to the interview? What questions should I prepare? What research have I done on this organization? Do I know anything about the hiring manager or team? What do the financials of the company look like? Are there any recent articles about their products, people or projects?
Answers to these questions will give you solid information and key insight to landing an offer.
But don't stop there -- know how to answer behavioral-based interview questions, and you will stand out from your competition.
Behavioral Basics
Behavioral-based interview questions are focused on bringing specific past projects, accomplishments and failures to light. Employers look for key past behaviors.
With the notion that past behaviors are a strong indicator of future behaviors, the hiring managers in today's marketplace will probe deep into your business life to see if you match up. The more recent the story about your career, the more relevant it will be in the mind of the interviewer.
Use "I" versus "we" when telling your past story. They are interested in your contributions and business behaviors, not someone else's.
Here are five key basics to know when answering behavioral-based questions:
1. Think like you're in your college English course.
Using the STAR format (Situation, Task, Action, Result) when answering a behavioral-based question is much like writing an English paper.
You need an Introduction (Situation or Task), the Body (Actions) and a Conclusion (Result).
The Situation or Task is the set up for your response, giving the hiring manager details of the story you are about to tell (When? Where? Who was involved?).
The Actions or behaviors that you demonstrated are why this type of question is asked. What did you specifically do? How did you handle this task? If you made a mistake, did you learn from it and avoid repeating it?
The Results must be measurable. Use percentages, dollar amounts, unit numbers, etc., to solidify a specific result.
Remember, these stories are all reference checkable, as they actually occurred sometime in the past, so be certain to check your facts first.
2. Perform a dress rehearsal.
Write down specific behavioral-based questions that you may hear, and role-play with someone who will give you "tough love" in return. This will keep your stories to a minimum, keep you focused on using the STAR format, and give you the necessary confidence to make that all-important positive impression.
3. It's OK to pause before answering.
Preparation works well for behavioral-based questions, however, you may hear a question that you didn't expect. Ask for a moment to collect your thoughts, and then follow the STAR format to response to the question.
4. Avoid tangents.
It's easy to keep talking about your past successes and accomplishments. Be warned, too many times the Interviewee keeps adding on to their story. Once you have provided the specific and measurable Results, stop talking. The interviewer will probe further if more information is required.
5. Do not answer with an opinion, a theory or a vague response.
Behavioral-based questions are targeting your past. Your opinion is simply your view or belief, and offers no detail around what you did on the job. A theoretical response carries no weight, as it is not valid experience. A vague response keeps the hiring manager guessing, and most likely probing further to extract the information that they are after.
Sunday, September 30, 2007
Wednesday, September 26, 2007
PHP Quetions for Interview
How can we submit from without a submit button?
What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?
What is the difference between $message and $$message?
What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?
What is the difference between $message and $$message?
Brain Teasers Questions for Interview
Which weighs more, a gram of feathers or a gram of gold?
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
Look at this series carefully 30 21 29 22 28 23 27 24 26 25 Can you tell what numbers would come next in this series.
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
Two planes take off at the same exact moment. They are flying across the Atlantic Ocean. One leaves New York and is flying to Paris at 800 km/hr. The other leaves Paris and is flying to New York at only 750 km/hr ( because of a strong head wind ). Which one will be closer to Paris when they meet?
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
I didn’t count the MIG fighter planes flying in the formation, but I do remember that one MIG was in front of two MIGs, another MIG behind two MIGs and another MIG between two MIGS. How many MIGs did I see
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What’s the fewest number of times you’d have to use the scale to find the heavier ball?
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
A point is chosen at random from within a circular region.What is the probability that the point is closer to the center of the region than it is to the boundary of the region?
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
How would you pour out exactly half of the water in a completely full cylindrical pot?
tilt the cylinder 45 degrees to the horizontal till the water levels from one edge to the diagonally opposite edge.
tilt the cylinder 45 degrees to the horizontal till the water levels from one edge to the diagonally opposite edge.
Brain Teasers Questions for Interview
There are 3 switches in one room that control 3 electrical lamps located in the other room.You are allowed to spend 5 minutes in the room with switches,change their position as you want.Then you should go to the room with lamps and tell exactly what switch controls every lamp.You can’t return to the room with switches
This one was asked in an interview for a junior electrical engineer at intel.
Ans- you have 3 stwitches. put one switch on. wait for 1 min. switch it off. put another switch on and go into the room with the lamps. The on lamp is ofcourse controlled by the switch you turned on last. the warm but off lamp is the switch you put on first and turned off. the off and cold lamp is controlled by the switch you never touched.
This one was asked in an interview for a junior electrical engineer at intel.
Ans- you have 3 stwitches. put one switch on. wait for 1 min. switch it off. put another switch on and go into the room with the lamps. The on lamp is ofcourse controlled by the switch you turned on last. the warm but off lamp is the switch you put on first and turned off. the off and cold lamp is controlled by the switch you never touched.
Brain Teasers Questions for Interview
A snail wants to creep on to the top of the tree 5m high. During the day it can creep up 3m but during the night it creeps down 2m. How many days does it need to reach the top?
3 Days.
First Day: 3-2=1m,
Second Day: 3-2=1m.
So, it creeped 2m at the end of the second day.
In the third day, 3 more meters it creeps to reach the peak.
3 Days.
First Day: 3-2=1m,
Second Day: 3-2=1m.
So, it creeped 2m at the end of the second day.
In the third day, 3 more meters it creeps to reach the peak.
Brain Teasers Questions for Interview
You have 2 candles. Every candle lights for 60 minutes. You have to find the way to measure 45 minutes
If you know the answer pls leave your comand...
If you know the answer pls leave your comand...
Brain Teasers Questions for Interview
Out of 10 coins, one weighs less then the others. You have a balance scale. How can you determine which one weighs less in 3 weighs?
Divide these 10 coins into 3 stacks of 3 coins each with one coin remaining. Two weighs will estalish if any stack contains the less weighing coin as that stack will weigh less.
If all stacks weigh same then the remaining coin is least weight.
Else the less weighing stack contains the coin. Again take two coins from that stack and place each on two sides of scale. If they weigh same, remaining coin is least weight else, the one which weighs less.
you divide them in 2 staks 5 and 5 of each one
after one weigh you establish which wheigs less…there is the coin we are looking for
you take one coin out of this stack…
you divide the other 4 reamining coins in 2 stacks 2 coins each..
after a second wheigh if they whey the same then the coin you took out is the ONE…if not…
the stack wich wheigs less is the one with the coin….with other words there are only 2 coins to compair ….you do that after a third wheigh…
Obs:the third wheigh may not be necesarry
Divide these 10 coins into 3 stacks of 3 coins each with one coin remaining. Two weighs will estalish if any stack contains the less weighing coin as that stack will weigh less.
If all stacks weigh same then the remaining coin is least weight.
Else the less weighing stack contains the coin. Again take two coins from that stack and place each on two sides of scale. If they weigh same, remaining coin is least weight else, the one which weighs less.
you divide them in 2 staks 5 and 5 of each one
after one weigh you establish which wheigs less…there is the coin we are looking for
you take one coin out of this stack…
you divide the other 4 reamining coins in 2 stacks 2 coins each..
after a second wheigh if they whey the same then the coin you took out is the ONE…if not…
the stack wich wheigs less is the one with the coin….with other words there are only 2 coins to compair ….you do that after a third wheigh…
Obs:the third wheigh may not be necesarry
Brain Teasers Questions for Interview
200lb of cucumbers was delivered to the grocery store and left in a storage room. The cucumbers contained 99% of water. After some time part of water evaporated and the contents of water in cucumbers became 98%. What is the weight of cucumbers now?
100 lbs
Initially the solid part is 1% of 200 lb, which is 2 lbs and all these 2 lbs stay there and becomes 2% of the total weight. So 2/2% = 100.
100 lbs
Initially the solid part is 1% of 200 lb, which is 2 lbs and all these 2 lbs stay there and becomes 2% of the total weight. So 2/2% = 100.
Tough Questions & Answers for Interview
1. Tell me about yourself.
My background to date has been centered around preparing myself to become the
very best ____ I can become. Let me tell you specifically how I’ve prepared
myself . . .
2. Why should I hire you?
Because I sincerely believe that I’m the best person for the job. I realize that there
are many other college students who have the ability to do this job. I also have
that ability.
But I also bring an additional quality that makes me the very best person for the job -
- my attitude for excellence. Not just giving lip service excellence, but
putting every part
of myself into achieving it. In ____ and ____ I have consistently reached for
becoming
the very best I can become by doing the following . . .
3. What is your long-range objective? Where do you want to be 10 or 15
years from now?
Although it’s certainly difficult to predict things far into the future, I know what
direction I want to develop toward. Within five years, I would like to become the very
best ____ your company has. In fact, my personal career mission statement is to
become a world-class ____ in the ____ industry. I will work toward becoming the
expert that others rely upon. And in doing so, I feel I will be fully prepared to take on
any greater responsibilities that might be presented in the long term.
4. How has your education prepared you for your career?
As you will note on my resume, I’ve taken not only the required core classes in the
____
field, I’ve also gone above and beyond. I’ve taken every class the college has to offer
the field and also completed an independent study project specifically in
in
this area. But
it’s not just taking the classes to gain academic knowledge -- I’ve taken each class,
both
inside and outside of my major, with this profession in mind. So when we’re studying
____ in ____, I’ve viewed it from the perspective of ____. In addition, I’ve always
tried to keep a practical view of how the information would apply to my job. Not just
theory, but how it would actually apply. My capstone course project in
my final semester
involved developing a real-world model of ____, which is very similar to what might
be
used within your company. Let me tell you more about it . . .
5. Are you a team player?
Very much so. In fact, I’ve had opportunities in both athletics and academics to
develop my skills as a team player. I was involved in ____ at the intramural level,
including leading my team in assists during the past year -- I always try to help
others
achieve their best. In academics, I’ve worked on several team projects, serving as
both a member and team leader. I’ve seen the value of working together as a team
to
achieve a greater goal than any one of us could have achieved individually. As an
example . . .
6. Have you ever had a conflict with a boss or professor? How was it
resolved?
Yes, I have had conflicts in the past. Never major ones, but certainly there have
been
situations where there was a disagreement that need to be resolved. I’ve found
that
when conflict occurs, it’s because of a failure to see both sides of the situation.
Therefore, I ask the other person to give me their perspective and at the same
time
ask that they allow me to fully explain my perspective. At that point, I would work
with
the person to find out if a compromise could be reached. If not, I would submit to
their
decision because they are my superior. In the end, you have to be willing to submit
yourself to the directives of your superior, whether you’re in full agreement or not.
An
example of this was when . . .
7. What is your greatest weakness?
I would say my greatest weakness has been my lack of proper planning in the past. I
would
over commit myself with too many variant tasks, then not be able to fully
accomplish
each as I would like. However, since I’ve come to recognize that weakness, I’ve taken
steps to correct it. For example, I now carry a planning calendar in my pocket so
that
I can plan all of my appointments and “ to do “ items. Here, let me show you how I
have
this week planned out . . .
8. If I were to ask your professors to describe you, what would they say?
I believe they would say I’m a very energetic person, that I put my mind to the task
at hand and see to it that it’s accomplished. They would say that if they ever had
something that need to be done, I was the person who they could always depend on to
see that it was accomplished. They would say that I always took a keen interest in
the
subjects I was studying and always sought ways to apply the knowledge in real world
settings. Am I just guessing that they would say these things? No, in fact, I’m quite
certain they would say those things because I have with me several letters of
recommendation from my professors, and those are their very words. Let me
show you . . .
9. What qualities do you feel a successful manager should have?
The key quality should be leadership -- the ability to be the visionary for the people
who
are working under them. The person who can set the course and direction for
subordinates.
A manager should also be a positive role model for others to follow. The highest
calling
of a true leader is inspiring others to reach the highest of their abilities. I’d like to
tell you about a person who I consider to be a true leader . . .
10. If you had to live your life over again, what would you change?
That’s a good question. I realize that it can be very easy to continually look back and
wish that things had been different in the past. But I also realize that things had
been
different in the past. But I also realize that things in the past cannot be changed,
that only things in the future can be changed. That’s why I continually strive to
improve
myself each and every day and that’s why I’m working hard to continually increase
my
knowledge in the ____ field. That’s also the reason why I want to become the very
best
____ your company has ever had. To make positive change. And all of that is still in
the future. So in answer to your question, there isn’t anything in my past that I
would change. I look only to the future to make changes in my life.
My background to date has been centered around preparing myself to become the
very best ____ I can become. Let me tell you specifically how I’ve prepared
myself . . .
2. Why should I hire you?
Because I sincerely believe that I’m the best person for the job. I realize that there
are many other college students who have the ability to do this job. I also have
that ability.
But I also bring an additional quality that makes me the very best person for the job -
- my attitude for excellence. Not just giving lip service excellence, but
putting every part
of myself into achieving it. In ____ and ____ I have consistently reached for
becoming
the very best I can become by doing the following . . .
3. What is your long-range objective? Where do you want to be 10 or 15
years from now?
Although it’s certainly difficult to predict things far into the future, I know what
direction I want to develop toward. Within five years, I would like to become the very
best ____ your company has. In fact, my personal career mission statement is to
become a world-class ____ in the ____ industry. I will work toward becoming the
expert that others rely upon. And in doing so, I feel I will be fully prepared to take on
any greater responsibilities that might be presented in the long term.
4. How has your education prepared you for your career?
As you will note on my resume, I’ve taken not only the required core classes in the
____
field, I’ve also gone above and beyond. I’ve taken every class the college has to offer
the field and also completed an independent study project specifically in
in
this area. But
it’s not just taking the classes to gain academic knowledge -- I’ve taken each class,
both
inside and outside of my major, with this profession in mind. So when we’re studying
____ in ____, I’ve viewed it from the perspective of ____. In addition, I’ve always
tried to keep a practical view of how the information would apply to my job. Not just
theory, but how it would actually apply. My capstone course project in
my final semester
involved developing a real-world model of ____, which is very similar to what might
be
used within your company. Let me tell you more about it . . .
5. Are you a team player?
Very much so. In fact, I’ve had opportunities in both athletics and academics to
develop my skills as a team player. I was involved in ____ at the intramural level,
including leading my team in assists during the past year -- I always try to help
others
achieve their best. In academics, I’ve worked on several team projects, serving as
both a member and team leader. I’ve seen the value of working together as a team
to
achieve a greater goal than any one of us could have achieved individually. As an
example . . .
6. Have you ever had a conflict with a boss or professor? How was it
resolved?
Yes, I have had conflicts in the past. Never major ones, but certainly there have
been
situations where there was a disagreement that need to be resolved. I’ve found
that
when conflict occurs, it’s because of a failure to see both sides of the situation.
Therefore, I ask the other person to give me their perspective and at the same
time
ask that they allow me to fully explain my perspective. At that point, I would work
with
the person to find out if a compromise could be reached. If not, I would submit to
their
decision because they are my superior. In the end, you have to be willing to submit
yourself to the directives of your superior, whether you’re in full agreement or not.
An
example of this was when . . .
7. What is your greatest weakness?
I would say my greatest weakness has been my lack of proper planning in the past. I
would
over commit myself with too many variant tasks, then not be able to fully
accomplish
each as I would like. However, since I’ve come to recognize that weakness, I’ve taken
steps to correct it. For example, I now carry a planning calendar in my pocket so
that
I can plan all of my appointments and “ to do “ items. Here, let me show you how I
have
this week planned out . . .
8. If I were to ask your professors to describe you, what would they say?
I believe they would say I’m a very energetic person, that I put my mind to the task
at hand and see to it that it’s accomplished. They would say that if they ever had
something that need to be done, I was the person who they could always depend on to
see that it was accomplished. They would say that I always took a keen interest in
the
subjects I was studying and always sought ways to apply the knowledge in real world
settings. Am I just guessing that they would say these things? No, in fact, I’m quite
certain they would say those things because I have with me several letters of
recommendation from my professors, and those are their very words. Let me
show you . . .
9. What qualities do you feel a successful manager should have?
The key quality should be leadership -- the ability to be the visionary for the people
who
are working under them. The person who can set the course and direction for
subordinates.
A manager should also be a positive role model for others to follow. The highest
calling
of a true leader is inspiring others to reach the highest of their abilities. I’d like to
tell you about a person who I consider to be a true leader . . .
10. If you had to live your life over again, what would you change?
That’s a good question. I realize that it can be very easy to continually look back and
wish that things had been different in the past. But I also realize that things had
been
different in the past. But I also realize that things in the past cannot be changed,
that only things in the future can be changed. That’s why I continually strive to
improve
myself each and every day and that’s why I’m working hard to continually increase
my
knowledge in the ____ field. That’s also the reason why I want to become the very
best
____ your company has ever had. To make positive change. And all of that is still in
the future. So in answer to your question, there isn’t anything in my past that I
would change. I look only to the future to make changes in my life.
Saturday, September 15, 2007
Interview Question of All Time
Over the course of the past 20 years, I've been searching for — among other things — the single best question to ask in an interview. What I wanted to create was a One-Question Interview, a stand-alone query that would pierce through the veneer of generalizations, overcome typical candidate nervousness, minimize the impact of the candidate's personality on the interviewer, eliminate the exaggeration which many candidates adopt as an interviewing ploy and actually determine if the candidate is competent and motivated to do the work required. I also wanted this question to begin the recruiting process, convincing the candidate by the question itself that the person asking it was sophisticated and professional, and that the company involved was a great place to grow a career.
As a goal, this, as I'm sure you'll agree, is not chopped liver. And through years of trial and error, I finally hit upon one question that did it all.
If you were allowed to ask only one question during the course of the interview, this would be it:
Please think about your most significant accomplishment. Now, could you tell me all about it?
To see why this simple question is so powerful, try it out on yourself. Imagine you're the candidate and I've just asked you this question. What accomplishment would you select? Then imagine over the course of the next 5-20 minutes that I obtained the following information from you about this accomplishment:
A complete description of the accomplishment
The company you worked for and what it did
The actual results achieved: numbers, facts, changes made, details, amounts
When it took place
How long it took
The importance of this accomplishment to the company
Your title and role
Why you were chosen
The 3-4 biggest challenges you faced and how you dealt with them
A few examples of leadership and initiative
Some of the major decisions made
The environment and resources available
How you made more resources available
The technical skills needed to accomplish the objective
The technical skills learned and how long it took to learn them
The actual role you played
The team involved and all of the reporting relationships
Some of the biggest mistakes you made
How you changed and grew as a person
What you would do differently if you could do it again
Aspects of the project you truly enjoyed
Aspects you didn't especially care about
The budget available and your role in preparing it and managing it
How you did on the project vs. the plan
How you developed the plan
How you motivated and influenced others, with specific examples to prove your claims
How you dealt with conflict with specific examples
Anything else you felt was important to the success of the project
If the accomplishment was big enough, and if the answer was detailed enough to take 15-20 minutes to complete, consider how much I, or any interviewer, would know about you. The insight gained from this type of question would be remarkable. Just about everything you need to know about a person's competency can be extracted from this type of question.
Most people would agree this type of question is very revealing. But the real issue is not the question: it's the information that's given in response that's most important. Few people are able to give this type of information without additional prompting from the interviewer. This is what real interviewing is about — getting the answer to this very simple but very powerful question. Don't spend time learning a lot of clever questions to ask during the interview: spend time learning to get the answer to just this one question. The key: understand the accomplishment, the process used to achieve the accomplishment, the environment in which the accomplishment took place and the candidate's role.
To expand upon the assessment, you can ask this same question in the same level of detail for a variety of different accomplishments. Ask the candidate to describe two to three different individual and team accomplishments for the past five to ten years. Put them in time order to see the growth and impact over time in different jobs, and with different companies. Also ask about accomplishments that directly relate to job specific needs, for example, "Describe your biggest accomplishment in setting up manufacturing scheduling systems."
With this approach to digging in and finding out about major accomplishments you'll have all you need to make a reasoned evaluation of a person's ability to deliver similar results in a similar environment to your own. Here's just a little of what you'll learn about a candidate from this type of questioning — initiative, commitment, team leadership, growth, potential, compatibility, comparability, character, true personality, applicable experience, ability to learn, and true interest and motivation to do the work required.
Few candidates will give you all of this information on their own, so it's the digging in that matters. It's the interviewer's responsibility to get this valuable information from the candidate, not the candidate's responsibility to give it to the interviewer. By fact-finding this way, you put all candidates on a level playing field. And when you can get all members of the interviewing team to conduct their interviews this way, you'll remove another key source of hiring errors — the tendency of most interviewers to talk too much, listen too little and ask a bunch of irrelevant questions. One question is all it takes.
As a goal, this, as I'm sure you'll agree, is not chopped liver. And through years of trial and error, I finally hit upon one question that did it all.
If you were allowed to ask only one question during the course of the interview, this would be it:
Please think about your most significant accomplishment. Now, could you tell me all about it?
To see why this simple question is so powerful, try it out on yourself. Imagine you're the candidate and I've just asked you this question. What accomplishment would you select? Then imagine over the course of the next 5-20 minutes that I obtained the following information from you about this accomplishment:
A complete description of the accomplishment
The company you worked for and what it did
The actual results achieved: numbers, facts, changes made, details, amounts
When it took place
How long it took
The importance of this accomplishment to the company
Your title and role
Why you were chosen
The 3-4 biggest challenges you faced and how you dealt with them
A few examples of leadership and initiative
Some of the major decisions made
The environment and resources available
How you made more resources available
The technical skills needed to accomplish the objective
The technical skills learned and how long it took to learn them
The actual role you played
The team involved and all of the reporting relationships
Some of the biggest mistakes you made
How you changed and grew as a person
What you would do differently if you could do it again
Aspects of the project you truly enjoyed
Aspects you didn't especially care about
The budget available and your role in preparing it and managing it
How you did on the project vs. the plan
How you developed the plan
How you motivated and influenced others, with specific examples to prove your claims
How you dealt with conflict with specific examples
Anything else you felt was important to the success of the project
If the accomplishment was big enough, and if the answer was detailed enough to take 15-20 minutes to complete, consider how much I, or any interviewer, would know about you. The insight gained from this type of question would be remarkable. Just about everything you need to know about a person's competency can be extracted from this type of question.
Most people would agree this type of question is very revealing. But the real issue is not the question: it's the information that's given in response that's most important. Few people are able to give this type of information without additional prompting from the interviewer. This is what real interviewing is about — getting the answer to this very simple but very powerful question. Don't spend time learning a lot of clever questions to ask during the interview: spend time learning to get the answer to just this one question. The key: understand the accomplishment, the process used to achieve the accomplishment, the environment in which the accomplishment took place and the candidate's role.
To expand upon the assessment, you can ask this same question in the same level of detail for a variety of different accomplishments. Ask the candidate to describe two to three different individual and team accomplishments for the past five to ten years. Put them in time order to see the growth and impact over time in different jobs, and with different companies. Also ask about accomplishments that directly relate to job specific needs, for example, "Describe your biggest accomplishment in setting up manufacturing scheduling systems."
With this approach to digging in and finding out about major accomplishments you'll have all you need to make a reasoned evaluation of a person's ability to deliver similar results in a similar environment to your own. Here's just a little of what you'll learn about a candidate from this type of questioning — initiative, commitment, team leadership, growth, potential, compatibility, comparability, character, true personality, applicable experience, ability to learn, and true interest and motivation to do the work required.
Few candidates will give you all of this information on their own, so it's the digging in that matters. It's the interviewer's responsibility to get this valuable information from the candidate, not the candidate's responsibility to give it to the interviewer. By fact-finding this way, you put all candidates on a level playing field. And when you can get all members of the interviewing team to conduct their interviews this way, you'll remove another key source of hiring errors — the tendency of most interviewers to talk too much, listen too little and ask a bunch of irrelevant questions. One question is all it takes.
Interview Tips
Get comfortable talking about yourself, your career and your accomplishments. Practice out loud and in front of family and friends.
Honesty, integrity, attitude, verbal skills and enthusiasm are the top qualities most employers are looking for in a candidate. Employers will ask questions that require candidates to talk about weaknesses, and take your body language into account as part of the answer.
Enthusiasm can sometimes offset a lack of experience or lack of training in some area.
And watch the "umms," "likes" and "you knows."
Bring with you your Social Security number or card, driver's license, résumé, and the names, job titles, addresses and phone numbers of three references.
Don't make your #1 choice of employment your first interview.
Know exactly why an employer should hire you and articulate this by citing experiences that best demonstrate your capabilities.
Wear comfortable, professional clothing. Do not chew gum or smoke.
Display a competitive edge. Think of leadership positions you have taken on and show how you have succeeded.
Be a great conversationalist. Many interviewers complain that they have a difficult time getting candidates to talk. Think of the interview as a two-way conversation in which you describe your most relevant skills, ask intelligent questions and convey a sense of enthusiasm about the position. Don't wait passively for the interviewer to ask you about your strongest qualities; make sure you work them into the discussion at every opportunity.
Honesty, integrity, attitude, verbal skills and enthusiasm are the top qualities most employers are looking for in a candidate. Employers will ask questions that require candidates to talk about weaknesses, and take your body language into account as part of the answer.
Enthusiasm can sometimes offset a lack of experience or lack of training in some area.
And watch the "umms," "likes" and "you knows."
Bring with you your Social Security number or card, driver's license, résumé, and the names, job titles, addresses and phone numbers of three references.
Don't make your #1 choice of employment your first interview.
Know exactly why an employer should hire you and articulate this by citing experiences that best demonstrate your capabilities.
Wear comfortable, professional clothing. Do not chew gum or smoke.
Display a competitive edge. Think of leadership positions you have taken on and show how you have succeeded.
Be a great conversationalist. Many interviewers complain that they have a difficult time getting candidates to talk. Think of the interview as a two-way conversation in which you describe your most relevant skills, ask intelligent questions and convey a sense of enthusiasm about the position. Don't wait passively for the interviewer to ask you about your strongest qualities; make sure you work them into the discussion at every opportunity.
Mistakes in Interview
1. A Lack of Enthusiasm
Attitude and sense of direction are vital to conveying a real love and interest in what you are pursuing. Make sure you give examples and demonstrate your interest in a particular area, don't just say you are interested.
2. Unprofessional Behavior
Think of all the ways that you present yourself to a potential employer, including via the telephone. Make sure you have an answering machine or voice mail that leaves a professional message. Forewarn roommates and family that you may be receiving calls from employers and instruct them on the type of message you would like to be taken.
It is appropriate to wear conservative business suits to interviews, even if the job is more casual than that. You want to dress better than you would if you were working there, because you are not working there yet.
Arriving late and rescheduling meetings are all too common signs that you aren't ready for the work world. If you commit to an interview time, keep it.
Always send a thank you note after the interview, and follow up with a quick, to-the-point phone call reaffirming your interest.
3. Poor Research Prior to Interviews
Research the field, the profession, and the company before the interview and be prepared with background facts and questions. Read newspapers and trade magazines to keep up with current company issues, such as mergers. Contact people in the company who are doing what you want to do and ask them how they got there.
4. Lying to Employers
Most recruiters will verify dates of employment, academic degrees, references, previous earnings, GPAs, club memberships, and whether candidates have criminal records. If you are found out to have lied after you get the position, you will most likely lose your job since you are usually required to sign a legal document attesting to the truth of your claims.
5. A Lack of Direction
Don't arrive at an interview hoping to be told by the recruiter what position you should be seeking, or expecting him to lay out career goals for you. The most effective candidates know where they are going and why. You should be able to articulate what you learned in your academic career and be able to explain how you plan to apply it. Focus, maturity and sense of self are crucial.
6. Weak Communication Skills
How you behave during an interview can be as impressive as what you say. Recruiters often complain about candidates who talk too much, listen poorly, and fail to ask questions. Make sure you listen for and remember critical information, such as the name of your interviewer. Asking good questions is key because it shows that you've researched and thought about important issues. Use proper English, avoid slang.
7. Failure to Sell Yourself
You need to sell employers on your skills and future value, and the best way to do so is by giving examples. Translate what you have done into skills employers can use. Samples of previous accomplishments, such as papers and projects you've completed, are a great way to demonstrate your skills.
Attitude and sense of direction are vital to conveying a real love and interest in what you are pursuing. Make sure you give examples and demonstrate your interest in a particular area, don't just say you are interested.
2. Unprofessional Behavior
Think of all the ways that you present yourself to a potential employer, including via the telephone. Make sure you have an answering machine or voice mail that leaves a professional message. Forewarn roommates and family that you may be receiving calls from employers and instruct them on the type of message you would like to be taken.
It is appropriate to wear conservative business suits to interviews, even if the job is more casual than that. You want to dress better than you would if you were working there, because you are not working there yet.
Arriving late and rescheduling meetings are all too common signs that you aren't ready for the work world. If you commit to an interview time, keep it.
Always send a thank you note after the interview, and follow up with a quick, to-the-point phone call reaffirming your interest.
3. Poor Research Prior to Interviews
Research the field, the profession, and the company before the interview and be prepared with background facts and questions. Read newspapers and trade magazines to keep up with current company issues, such as mergers. Contact people in the company who are doing what you want to do and ask them how they got there.
4. Lying to Employers
Most recruiters will verify dates of employment, academic degrees, references, previous earnings, GPAs, club memberships, and whether candidates have criminal records. If you are found out to have lied after you get the position, you will most likely lose your job since you are usually required to sign a legal document attesting to the truth of your claims.
5. A Lack of Direction
Don't arrive at an interview hoping to be told by the recruiter what position you should be seeking, or expecting him to lay out career goals for you. The most effective candidates know where they are going and why. You should be able to articulate what you learned in your academic career and be able to explain how you plan to apply it. Focus, maturity and sense of self are crucial.
6. Weak Communication Skills
How you behave during an interview can be as impressive as what you say. Recruiters often complain about candidates who talk too much, listen poorly, and fail to ask questions. Make sure you listen for and remember critical information, such as the name of your interviewer. Asking good questions is key because it shows that you've researched and thought about important issues. Use proper English, avoid slang.
7. Failure to Sell Yourself
You need to sell employers on your skills and future value, and the best way to do so is by giving examples. Translate what you have done into skills employers can use. Samples of previous accomplishments, such as papers and projects you've completed, are a great way to demonstrate your skills.
THE SECOND INTERVIEW
The second interview is often the point at which you may receive a job offer from the employer. At the same time, it is an opportunity for you to consider the company environment and work style to see if it is a fit for you. Would you want to spend the majority of your day in this organization? By observing the environment and asking questions, you will be able to assess the culture.
Things to observe:
Dress Code
Numbers of men and women
Age groups
Condition of facility (old or new)
Presence of technology
Interactions between staff
Environment (formal or relaxed)
Tips:
Make sure you understand the arrangements in advance.
Location
Travel Arrangements
Expenses (Prepaid or will you be reimbursed?)
Contacts (With whom will you be meeting?)
Be prepared for a full day of interviewing.
A typical interview day can be up to eight hours long, and during this time you might participate in up to12 interviews. You may be presented with the following situations as well:
Case Interview: In this type of interview, the interviewer takes the candidate through a series of steps and evaluates how (s)he tackles the various levels. The steps can range from identifying a critical issue, to breaking a problem into component parts, to finally identifying one or more solutions.
Step 1: Big Picture Thinking: The interviewer lays out the facts and asks the candidate to articulate the critical issues facing the business. This requires an ability to focus on key issues, not every issue. The interviewer will then ask why the candidate chose the answer s(he) did.
Step 2: Problem Solving Logic: The interviewer asks the candidate to lay out all the elements of the problem: What factors should be considered?
Step 3: Focusing on Value: The interviewer then lets the candidate choose which avenues to pursue, leaving the discussion open-ended. The interviewer determines if the candidate is instinctive about which path to choose and asks why the candidate selected this path.
Step 4: Depth and Breadth - Business Intuition: The interviewer asks the candidate some probing questions about how (s)he would analyze a key area.
Step 5: Results Orientation: The interviewer asks the candidate how (s)he would implement his/her solution. The interviewer could pose a tricky or hostile client situation to see how candidate would get results in a difficult environment.
(Taken from "How to Ace the Case Interview," Bain & Company)
Writing Samples: The interviewer will ask you to produce a writing sample on the spot. They may want you to defend or argue a particular issue, or summarize data to support a philosophy or viewpoint.
Problem Solving Questions: You may be asked to solve a particular problem, either off the top of your head or with a paper and pencil, during the interview. Some examples of this are probability and quantitative problems.
Group Interviews: In this type of interview, you will meet with several interviewers simultaneously. They may be from different departments around the company or all from the department for which you are interviewing to obtain a position. It is important to be aware of who is in your interview, so that you can address issues in your answers and questions that pertain to those positions and departments. You should remember to address the whole group when answering a question.
Answer each question with the same enthusiasm as you did the first time you were asked. You will be meeting with a number of people who will have no idea what you discussed previous to their interview.
Be concise. Confine your responses to what the interviewer has asked you to explain.
Provide logical back-up for your answers. Be sure to explain what case facts led you to a conclusion, and how you reasoned from those facts to your conclusion.
Do not be afraid to ask clarifying questions. If you don't understand the facts, it will be difficult to answer correctly.
Do additional research.
Know the employer thoroughly and have an in-depth understanding of the career field that you are interested in entering.
Follow up with a thank you letter.
It is not necessary to send a thank you letter to every person with whom you interviewed. It is usually sufficient to send one to the person who coordinated the visit
Things to observe:
Dress Code
Numbers of men and women
Age groups
Condition of facility (old or new)
Presence of technology
Interactions between staff
Environment (formal or relaxed)
Tips:
Make sure you understand the arrangements in advance.
Location
Travel Arrangements
Expenses (Prepaid or will you be reimbursed?)
Contacts (With whom will you be meeting?)
Be prepared for a full day of interviewing.
A typical interview day can be up to eight hours long, and during this time you might participate in up to12 interviews. You may be presented with the following situations as well:
Case Interview: In this type of interview, the interviewer takes the candidate through a series of steps and evaluates how (s)he tackles the various levels. The steps can range from identifying a critical issue, to breaking a problem into component parts, to finally identifying one or more solutions.
Step 1: Big Picture Thinking: The interviewer lays out the facts and asks the candidate to articulate the critical issues facing the business. This requires an ability to focus on key issues, not every issue. The interviewer will then ask why the candidate chose the answer s(he) did.
Step 2: Problem Solving Logic: The interviewer asks the candidate to lay out all the elements of the problem: What factors should be considered?
Step 3: Focusing on Value: The interviewer then lets the candidate choose which avenues to pursue, leaving the discussion open-ended. The interviewer determines if the candidate is instinctive about which path to choose and asks why the candidate selected this path.
Step 4: Depth and Breadth - Business Intuition: The interviewer asks the candidate some probing questions about how (s)he would analyze a key area.
Step 5: Results Orientation: The interviewer asks the candidate how (s)he would implement his/her solution. The interviewer could pose a tricky or hostile client situation to see how candidate would get results in a difficult environment.
(Taken from "How to Ace the Case Interview," Bain & Company)
Writing Samples: The interviewer will ask you to produce a writing sample on the spot. They may want you to defend or argue a particular issue, or summarize data to support a philosophy or viewpoint.
Problem Solving Questions: You may be asked to solve a particular problem, either off the top of your head or with a paper and pencil, during the interview. Some examples of this are probability and quantitative problems.
Group Interviews: In this type of interview, you will meet with several interviewers simultaneously. They may be from different departments around the company or all from the department for which you are interviewing to obtain a position. It is important to be aware of who is in your interview, so that you can address issues in your answers and questions that pertain to those positions and departments. You should remember to address the whole group when answering a question.
Answer each question with the same enthusiasm as you did the first time you were asked. You will be meeting with a number of people who will have no idea what you discussed previous to their interview.
Be concise. Confine your responses to what the interviewer has asked you to explain.
Provide logical back-up for your answers. Be sure to explain what case facts led you to a conclusion, and how you reasoned from those facts to your conclusion.
Do not be afraid to ask clarifying questions. If you don't understand the facts, it will be difficult to answer correctly.
Do additional research.
Know the employer thoroughly and have an in-depth understanding of the career field that you are interested in entering.
Follow up with a thank you letter.
It is not necessary to send a thank you letter to every person with whom you interviewed. It is usually sufficient to send one to the person who coordinated the visit
INAPPROPRIATE INTERVIEW QUESTIONS
There are certain questions which are not related to how well a person can perform a particular job. In some cases, they are also illegal. You should be aware of these topics and be prepared to respond. Here are some alternatives to answering inappropriate questions:
1. If you are not bothered by the question asked, you can answer honestly.
2. If you are bothered by the question, tactfully respond without offending the interviewer.
For example, "I really don't feel that ______would have an impact on my ability to
do this job" or "I've carefully considered all factors relating to this job and my
personal affairs are in order."
Examples of inappropriate interview questions:
1. Are you married, divorced, separated or single?
2. How old are you?
3. Do you have any children? What child care arrangements have you made?
4. Do you go to church?
5. Do you have any debts?
6. Do you own or rent your home?
7. To what social and political groups do you belong ?
8. Are you living with anyone?
9. Have you ever been arrested?
10. How much do you weigh? How tall are you?
11. Where were you born? Are you a U.S. citizen?
12. Do you have any handicaps or disabilities?
1. If you are not bothered by the question asked, you can answer honestly.
2. If you are bothered by the question, tactfully respond without offending the interviewer.
For example, "I really don't feel that ______would have an impact on my ability to
do this job" or "I've carefully considered all factors relating to this job and my
personal affairs are in order."
Examples of inappropriate interview questions:
1. Are you married, divorced, separated or single?
2. How old are you?
3. Do you have any children? What child care arrangements have you made?
4. Do you go to church?
5. Do you have any debts?
6. Do you own or rent your home?
7. To what social and political groups do you belong ?
8. Are you living with anyone?
9. Have you ever been arrested?
10. How much do you weigh? How tall are you?
11. Where were you born? Are you a U.S. citizen?
12. Do you have any handicaps or disabilities?
QUESTIONS TO ASK THE INTERVIEWER
1. What might a typical work day in this job be like?
2. What are some typical trainee assignments?
3. How does this position relate to other positions within the organization?
4. What type of career paths do people typically follow within this organization?
5. What kind of supervision will I receive?
6. How will my performance be evaluated?
7. What opportunities exist for continued training?
8. What is the organization's policy regarding continuing education?
9. What are the organization's short-range and long-range goals?
10. I was reading about ________ in your organization's literature, and am interested in learning more about it. Can you tell me more?
11. Do your employees participate in any professional associations or conferences?
12. As an employee of this organization, what do you see as some of its outstanding attributes?
13. How would you describe the work environment in your organization?
14. What makes your organization different from your competitors?
15. Who are the people with whom I will be working? May I talk with some of them?
16. In the last five years, how many persons have held this position? Where are they now?
17. Do you expect the person you hire to assume responsibilities in new areas?
18. May I have a copy of the job description?
19. What might be a typical first assignment?
20. What type of immediate and ongoing training can I expect?
21. What do you consider the ideal background for this position?
22. Why do you think this job might be the right spot for me?
DO NOT ASK questions about salaries and benefits unless the interviewer introduces these topics.
2. What are some typical trainee assignments?
3. How does this position relate to other positions within the organization?
4. What type of career paths do people typically follow within this organization?
5. What kind of supervision will I receive?
6. How will my performance be evaluated?
7. What opportunities exist for continued training?
8. What is the organization's policy regarding continuing education?
9. What are the organization's short-range and long-range goals?
10. I was reading about ________ in your organization's literature, and am interested in learning more about it. Can you tell me more?
11. Do your employees participate in any professional associations or conferences?
12. As an employee of this organization, what do you see as some of its outstanding attributes?
13. How would you describe the work environment in your organization?
14. What makes your organization different from your competitors?
15. Who are the people with whom I will be working? May I talk with some of them?
16. In the last five years, how many persons have held this position? Where are they now?
17. Do you expect the person you hire to assume responsibilities in new areas?
18. May I have a copy of the job description?
19. What might be a typical first assignment?
20. What type of immediate and ongoing training can I expect?
21. What do you consider the ideal background for this position?
22. Why do you think this job might be the right spot for me?
DO NOT ASK questions about salaries and benefits unless the interviewer introduces these topics.
SAMPLE INTERVIEW QUESTIONS ASKED BY EMPLOYERS
1. Tell me about yourself.
2. Why did you choose to attend Colgate University?
3. How did you choose your major?
4. What college classes have you enjoyed the most and why? The least?
5. If you could go back and change any part of your college experience, what would it be? Why?
6. What changes would you make in your college or university? Why?
7. Tell me about your most rewarding experience.
8. What accomplishments have given you the most satisfaction? Why?
9. Do you think that your grades are a good indicator of your academic achievement?
10. What have you learned from your participation in extra-curricular activities?
11. Do you have plans for further education?
12. In what kind of work environment are you most comfortable?
13. How do you work under pressure?
14. How has your education prepared you for the work world? This specific job?
15. What are your short- and long-term goals?
16. What do you consider to be your greatest strengths and weaknesses?
17. How would your friends describe you?
18. What is it that you do really well?
19. If you were hiring for this position, what qualities would you look for in a candidate?
20. Why should I hire you?
21. Describe your ideal job.
22. Why did you decide to seek a position with this company/organization?
23. What do you know about our company?
24. What criteria are you using to evaluate the company for which you hope to work?
25. What other types of jobs are you considering? Other organizations?
26. How do you feel about traveling/working overtime/spending weekends in the office?
27. What factors are most important to you in a job?
28. What do you see yourself doing in five years? In ten years?
29. What do you really want to do in life?
30. What motivates you to put forth your greatest effort?
31. What do you find personally rewarding?
32. Do you prefer to work in a group or alone?
33. What qualities should a successful supervisor/manager possess?
34. What have you learned from your mistakes?
35. What has inspired you the most in your life?
36. How do you spend your spare time?
37. What percentage of college expenses did you earn? How?
38. How did you spend your vacations while in school?
39. Do you prefer any specific geographic location? Why?
40. Which of your college years was most difficult? Why?
41. Tell me about your (management/educational) philosophy.
42. Give me your definition of success.
43. In what ways do you think you can make a contribution to our company?
44. What have you done that shows initiative and willingness to work?
45. How do you react to criticism?
46. What frustrates you?
47. Have you had any supervisory experience?
48. When could you start work?
49. Do you consider yourself a creative person?
50. Have you held a leadership position?
52. Describe yourself with one word.
53. Why did you choose your particular field of work?
54. What qualifications do you have that you think will make you successful in your field?
55. Have you ever had any difficulty getting along with fellow students or faculty?
56. What do you think it takes to be successful in a company like ours?
57. In what part-time or summer jobs have you been most interested and why?
58. What major problem have you encountered and how did you deal with it?
59. How have you changed since you started college?
60. Is there anything else you would like to tell me?
2. Why did you choose to attend Colgate University?
3. How did you choose your major?
4. What college classes have you enjoyed the most and why? The least?
5. If you could go back and change any part of your college experience, what would it be? Why?
6. What changes would you make in your college or university? Why?
7. Tell me about your most rewarding experience.
8. What accomplishments have given you the most satisfaction? Why?
9. Do you think that your grades are a good indicator of your academic achievement?
10. What have you learned from your participation in extra-curricular activities?
11. Do you have plans for further education?
12. In what kind of work environment are you most comfortable?
13. How do you work under pressure?
14. How has your education prepared you for the work world? This specific job?
15. What are your short- and long-term goals?
16. What do you consider to be your greatest strengths and weaknesses?
17. How would your friends describe you?
18. What is it that you do really well?
19. If you were hiring for this position, what qualities would you look for in a candidate?
20. Why should I hire you?
21. Describe your ideal job.
22. Why did you decide to seek a position with this company/organization?
23. What do you know about our company?
24. What criteria are you using to evaluate the company for which you hope to work?
25. What other types of jobs are you considering? Other organizations?
26. How do you feel about traveling/working overtime/spending weekends in the office?
27. What factors are most important to you in a job?
28. What do you see yourself doing in five years? In ten years?
29. What do you really want to do in life?
30. What motivates you to put forth your greatest effort?
31. What do you find personally rewarding?
32. Do you prefer to work in a group or alone?
33. What qualities should a successful supervisor/manager possess?
34. What have you learned from your mistakes?
35. What has inspired you the most in your life?
36. How do you spend your spare time?
37. What percentage of college expenses did you earn? How?
38. How did you spend your vacations while in school?
39. Do you prefer any specific geographic location? Why?
40. Which of your college years was most difficult? Why?
41. Tell me about your (management/educational) philosophy.
42. Give me your definition of success.
43. In what ways do you think you can make a contribution to our company?
44. What have you done that shows initiative and willingness to work?
45. How do you react to criticism?
46. What frustrates you?
47. Have you had any supervisory experience?
48. When could you start work?
49. Do you consider yourself a creative person?
50. Have you held a leadership position?
52. Describe yourself with one word.
53. Why did you choose your particular field of work?
54. What qualifications do you have that you think will make you successful in your field?
55. Have you ever had any difficulty getting along with fellow students or faculty?
56. What do you think it takes to be successful in a company like ours?
57. In what part-time or summer jobs have you been most interested and why?
58. What major problem have you encountered and how did you deal with it?
59. How have you changed since you started college?
60. Is there anything else you would like to tell me?
SAMPLE INTERVIEW QUESTIONS ASKED BY EMPLOYERS
1. Tell me about yourself.
2. Why did you choose to attend Colgate University?
3. How did you choose your major?
4. What college classes have you enjoyed the most and why? The least?
5. If you could go back and change any part of your college experience, what would it be? Why?
6. What changes would you make in your college or university? Why?
7. Tell me about your most rewarding experience.
8. What accomplishments have given you the most satisfaction? Why?
9. Do you think that your grades are a good indicator of your academic achievement?
10. What have you learned from your participation in extra-curricular activities?
11. Do you have plans for further education?
12. In what kind of work environment are you most comfortable?
13. How do you work under pressure?
14. How has your education prepared you for the work world? This specific job?
15. What are your short- and long-term goals?
16. What do you consider to be your greatest strengths and weaknesses?
17. How would your friends describe you?
18. What is it that you do really well?
19. If you were hiring for this position, what qualities would you look for in a candidate?
20. Why should I hire you?
21. Describe your ideal job.
22. Why did you decide to seek a position with this company/organization?
23. What do you know about our company?
24. What criteria are you using to evaluate the company for which you hope to work?
25. What other types of jobs are you considering? Other organizations?
26. How do you feel about traveling/working overtime/spending weekends in the office?
27. What factors are most important to you in a job?
28. What do you see yourself doing in five years? In ten years?
29. What do you really want to do in life?
30. What motivates you to put forth your greatest effort?
31. What do you find personally rewarding?
32. Do you prefer to work in a group or alone?
33. What qualities should a successful supervisor/manager possess?
34. What have you learned from your mistakes?
35. What has inspired you the most in your life?
36. How do you spend your spare time?
37. What percentage of college expenses did you earn? How?
38. How did you spend your vacations while in school?
39. Do you prefer any specific geographic location? Why?
40. Which of your college years was most difficult? Why?
41. Tell me about your (management/educational) philosophy.
42. Give me your definition of success.
43. In what ways do you think you can make a contribution to our company?
44. What have you done that shows initiative and willingness to work?
45. How do you react to criticism?
46. What frustrates you?
47. Have you had any supervisory experience?
48. When could you start work?
49. Do you consider yourself a creative person?
50. Have you held a leadership position?
52. Describe yourself with one word.
53. Why did you choose your particular field of work?
54. What qualifications do you have that you think will make you successful in your field?
55. Have you ever had any difficulty getting along with fellow students or faculty?
56. What do you think it takes to be successful in a company like ours?
57. In what part-time or summer jobs have you been most interested and why?
58. What major problem have you encountered and how did you deal with it?
59. How have you changed since you started college?
60. Is there anything else you would like to tell me?
2. Why did you choose to attend Colgate University?
3. How did you choose your major?
4. What college classes have you enjoyed the most and why? The least?
5. If you could go back and change any part of your college experience, what would it be? Why?
6. What changes would you make in your college or university? Why?
7. Tell me about your most rewarding experience.
8. What accomplishments have given you the most satisfaction? Why?
9. Do you think that your grades are a good indicator of your academic achievement?
10. What have you learned from your participation in extra-curricular activities?
11. Do you have plans for further education?
12. In what kind of work environment are you most comfortable?
13. How do you work under pressure?
14. How has your education prepared you for the work world? This specific job?
15. What are your short- and long-term goals?
16. What do you consider to be your greatest strengths and weaknesses?
17. How would your friends describe you?
18. What is it that you do really well?
19. If you were hiring for this position, what qualities would you look for in a candidate?
20. Why should I hire you?
21. Describe your ideal job.
22. Why did you decide to seek a position with this company/organization?
23. What do you know about our company?
24. What criteria are you using to evaluate the company for which you hope to work?
25. What other types of jobs are you considering? Other organizations?
26. How do you feel about traveling/working overtime/spending weekends in the office?
27. What factors are most important to you in a job?
28. What do you see yourself doing in five years? In ten years?
29. What do you really want to do in life?
30. What motivates you to put forth your greatest effort?
31. What do you find personally rewarding?
32. Do you prefer to work in a group or alone?
33. What qualities should a successful supervisor/manager possess?
34. What have you learned from your mistakes?
35. What has inspired you the most in your life?
36. How do you spend your spare time?
37. What percentage of college expenses did you earn? How?
38. How did you spend your vacations while in school?
39. Do you prefer any specific geographic location? Why?
40. Which of your college years was most difficult? Why?
41. Tell me about your (management/educational) philosophy.
42. Give me your definition of success.
43. In what ways do you think you can make a contribution to our company?
44. What have you done that shows initiative and willingness to work?
45. How do you react to criticism?
46. What frustrates you?
47. Have you had any supervisory experience?
48. When could you start work?
49. Do you consider yourself a creative person?
50. Have you held a leadership position?
52. Describe yourself with one word.
53. Why did you choose your particular field of work?
54. What qualifications do you have that you think will make you successful in your field?
55. Have you ever had any difficulty getting along with fellow students or faculty?
56. What do you think it takes to be successful in a company like ours?
57. In what part-time or summer jobs have you been most interested and why?
58. What major problem have you encountered and how did you deal with it?
59. How have you changed since you started college?
60. Is there anything else you would like to tell me?
Interview Preparation
Self-Assessment:
Think about your skills, interests, strengths and weaknesses.
Research the Organization:
Employers expect you to demonstrate knowledge of their organization. You should be able to articulate what programs and positions the company offers, and how your abilities fill its needs in these areas. You should also be aware of general information about the company's size, location, services and products. You can find this information on the internet, by using employer resources in the career library, or by writing to the company for literature.
Materials:
Make sure you know the name of the interviewer, and the time and the place of the interview. Get proper directions and plan to arrive early. Bring several copies of your résumé and any other relevant documents, such as samples of writing, projects you've worked on, awards or photos. Don't forget to have the names, addresses and phone numbers of references with you. Ask the interviewer for a business card so you'll have the necessary information to write a thank you note.
Appearance:
Dress professionally, conservatively and comfortably.
Mock Interview:
The Center for Career Services offers a unique opportunity to participate in an interview experience with our professional staff before you have an employment interview. You should dress as if you were on an actual interview, so you can get a more realistic feel of being in an interview and see how you come across. You should also bring a résumé to allow the career professional to ask you questions relevant to your experiences. The mock interviews are videotaped so that your responses can be reviewed and discussed. A review of the videotape will show you what you did well and what you should work on, enabling you to be more comfortable and confident when the time arrives for the real thing.
Think about your skills, interests, strengths and weaknesses.
Research the Organization:
Employers expect you to demonstrate knowledge of their organization. You should be able to articulate what programs and positions the company offers, and how your abilities fill its needs in these areas. You should also be aware of general information about the company's size, location, services and products. You can find this information on the internet, by using employer resources in the career library, or by writing to the company for literature.
Materials:
Make sure you know the name of the interviewer, and the time and the place of the interview. Get proper directions and plan to arrive early. Bring several copies of your résumé and any other relevant documents, such as samples of writing, projects you've worked on, awards or photos. Don't forget to have the names, addresses and phone numbers of references with you. Ask the interviewer for a business card so you'll have the necessary information to write a thank you note.
Appearance:
Dress professionally, conservatively and comfortably.
Mock Interview:
The Center for Career Services offers a unique opportunity to participate in an interview experience with our professional staff before you have an employment interview. You should dress as if you were on an actual interview, so you can get a more realistic feel of being in an interview and see how you come across. You should also bring a résumé to allow the career professional to ask you questions relevant to your experiences. The mock interviews are videotaped so that your responses can be reviewed and discussed. A review of the videotape will show you what you did well and what you should work on, enabling you to be more comfortable and confident when the time arrives for the real thing.
SAMPLE INTERVIEW QUESTIONS
Both the Hire Success Personality Profile Report and the Hire Assist Integrity Survey provide a Sample Interview Questions section to each report. Questions are developed based on how each applicant answers the test questions. On the Personality Profile, there are several criteria that will trigger questions. One of the most common is whenever the system determines there is a high probability that a certain personality traits may be "situational". For example, each Trait scale provides a range between two generally mutually exclusive traits, like "introverted" and "extroverted". If an employee or applicant answers the questions on the test form in such a way that indicates they have reasonably strong characteristics of BOTH a very introverted person and an extroverted person, Sample Interview Questions are generated to help you learn why they responded in that way on the test.
In most cases, you will find the traits on that scale will appear in their personality based on the situation or environment in which they are in at the time. The key for you, as an employer, is to present some reasonable scenarios regarding the job or position for which they have applied, and learn how they may react in those situations. In many cases, their responses will be quite appropriate and perhaps just what you're looking for. Having the ability to identify potentially "situational" traits, is a unique feature of the Hire Success Personality Profile. Another less common reason why the person may have answered the questions inconsistently, is they may have been trying to sway the results of the test. Although less common than situational, the Sample Interview Questions can be a real asset during the interview, as the last thing an applicant wants to hear questions about are the traits they were trying to sway. Seeing their reactions to the questions will tell you a quite a bit about them and if they were being truthful on the test.
WHY INTERVIEW QUESTIONS ARE HELPFUL - Studies have shown that most interviewers ask essentially the SAME questions. Most applicants have gone on many interviews before they arrive at your business, and they have heard the same questions over and over. They are often better prepared with answers for those questions, than you are for interviewing them.
In fact, many web sites, like Monster.com, provide instructions on HOW to answers the most common Interview Questions to make the applicant look good. As an employer, you know that the interview is not a "beauty contest" to see who can look the best, but it is your limited opportunity to try to get to know the applicant well enough so you can make an informed, and accurate decision as whether to hire the person or not. All too often, employers tell us applicants looked "great" during the interview and said all the "right" things, but when they got on the job, they weren't anything like what they appeared during the interview.
If this has ever happened to you, you understand the importance of conducting an in-depth interview. The questions on the Hire Success "Sample Interview Questions" Report will be questions they've probably never heard in an interview before because they are based solely on how they answered the questions, and all questions are business and job related.
MULTI-TIERED INTERVIEWS - A problem companies often encounter with multi-tiered interviews, is that the more levels of interviews the applicant is exposed to in your company, the more people are telling them what you are looking for in an applicant. By the time they make it to the final interview, usually with top management, they've been well prepared by the previous interviews to be able to tell you exactly what you want to hear.
Some customers want to only test the final few candidates for each job rather than purchasing tests for every applicant or employee who may apply for the position. Here are our recommendations for your consideration:
TEST EVERY APPLICANT THAT APPLIES - The Hire Success system is designed so you can have every applicant that applies for a job take our Personality Profile, either online, or by pencil and paper. In most cases, our customers ask the applicant to mail or fax their resume, and go online and take the Personality Profile. Since online test forms arrive by email, you have not paid anything for them to have taken the test; you only have an email with their answers. No paid credits are deducted from your Hire Success System until you SCORE the test. We suggest saving the email message until you've received the resume or application. If they do not have the background, education or experience you're looking for, and you can't interview them, simply DELETE the email form information and you've paid NOTHING for them to have taken the test.
RUN REPORTS ON ALL QUALIFIED APPLICANTS - Instead of waiting for the applicant to go through several levels of interviews, score the tests for every applicant that does have the background, education and experience you're looking for. Using the Hire Success "Baseline" features, you can quickly identify those candidates who also have the Personality closest to the best employees in that job in your company. Put those people on a "fast track" for the interview so you don't lose the opportunity to hire them in case they are offered another position before you can get around to a series of interviews. Many "top" employees are never interviewed, either because they weren't properly identified quickly enough, or they took another job offer before they completed the interview process with other companies. Don't put yourself in the position of having only the "second tier" of applicants from which to choose.
INCREASING THE ACCURACY OF THE REPORT - Although the COST of Hire Success Reports is so LOW, that any company can't afford NOT to test all qualified applicants, some companies still only want to test the top 2 or 3 candidates that make it through the interview process. It is still most beneficial to have had all applicants at least take the test online and gather the information prior to even the first interview. The more interviews they have with people in your company, the more they have been told what you're looking for and the greater the temptation to answer test questions based on what they "think" you want, rather than solely what they are really like. Since it COSTS NOTHING to test people online and hold onto their answers, even if you only score the final few candidates, the information you have will have been based on their answers BEFORE anyone told them the characteristics of the ideal employee.
In most cases, you will find the traits on that scale will appear in their personality based on the situation or environment in which they are in at the time. The key for you, as an employer, is to present some reasonable scenarios regarding the job or position for which they have applied, and learn how they may react in those situations. In many cases, their responses will be quite appropriate and perhaps just what you're looking for. Having the ability to identify potentially "situational" traits, is a unique feature of the Hire Success Personality Profile. Another less common reason why the person may have answered the questions inconsistently, is they may have been trying to sway the results of the test. Although less common than situational, the Sample Interview Questions can be a real asset during the interview, as the last thing an applicant wants to hear questions about are the traits they were trying to sway. Seeing their reactions to the questions will tell you a quite a bit about them and if they were being truthful on the test.
WHY INTERVIEW QUESTIONS ARE HELPFUL - Studies have shown that most interviewers ask essentially the SAME questions. Most applicants have gone on many interviews before they arrive at your business, and they have heard the same questions over and over. They are often better prepared with answers for those questions, than you are for interviewing them.
In fact, many web sites, like Monster.com, provide instructions on HOW to answers the most common Interview Questions to make the applicant look good. As an employer, you know that the interview is not a "beauty contest" to see who can look the best, but it is your limited opportunity to try to get to know the applicant well enough so you can make an informed, and accurate decision as whether to hire the person or not. All too often, employers tell us applicants looked "great" during the interview and said all the "right" things, but when they got on the job, they weren't anything like what they appeared during the interview.
If this has ever happened to you, you understand the importance of conducting an in-depth interview. The questions on the Hire Success "Sample Interview Questions" Report will be questions they've probably never heard in an interview before because they are based solely on how they answered the questions, and all questions are business and job related.
MULTI-TIERED INTERVIEWS - A problem companies often encounter with multi-tiered interviews, is that the more levels of interviews the applicant is exposed to in your company, the more people are telling them what you are looking for in an applicant. By the time they make it to the final interview, usually with top management, they've been well prepared by the previous interviews to be able to tell you exactly what you want to hear.
Some customers want to only test the final few candidates for each job rather than purchasing tests for every applicant or employee who may apply for the position. Here are our recommendations for your consideration:
TEST EVERY APPLICANT THAT APPLIES - The Hire Success system is designed so you can have every applicant that applies for a job take our Personality Profile, either online, or by pencil and paper. In most cases, our customers ask the applicant to mail or fax their resume, and go online and take the Personality Profile. Since online test forms arrive by email, you have not paid anything for them to have taken the test; you only have an email with their answers. No paid credits are deducted from your Hire Success System until you SCORE the test. We suggest saving the email message until you've received the resume or application. If they do not have the background, education or experience you're looking for, and you can't interview them, simply DELETE the email form information and you've paid NOTHING for them to have taken the test.
RUN REPORTS ON ALL QUALIFIED APPLICANTS - Instead of waiting for the applicant to go through several levels of interviews, score the tests for every applicant that does have the background, education and experience you're looking for. Using the Hire Success "Baseline" features, you can quickly identify those candidates who also have the Personality closest to the best employees in that job in your company. Put those people on a "fast track" for the interview so you don't lose the opportunity to hire them in case they are offered another position before you can get around to a series of interviews. Many "top" employees are never interviewed, either because they weren't properly identified quickly enough, or they took another job offer before they completed the interview process with other companies. Don't put yourself in the position of having only the "second tier" of applicants from which to choose.
INCREASING THE ACCURACY OF THE REPORT - Although the COST of Hire Success Reports is so LOW, that any company can't afford NOT to test all qualified applicants, some companies still only want to test the top 2 or 3 candidates that make it through the interview process. It is still most beneficial to have had all applicants at least take the test online and gather the information prior to even the first interview. The more interviews they have with people in your company, the more they have been told what you're looking for and the greater the temptation to answer test questions based on what they "think" you want, rather than solely what they are really like. Since it COSTS NOTHING to test people online and hold onto their answers, even if you only score the final few candidates, the information you have will have been based on their answers BEFORE anyone told them the characteristics of the ideal employee.
Thursday, September 13, 2007
EJB interview questions
* Is is possible for an EJB client to marshal an object of class java.lang.Class to an EJB?
Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules of the Java language.
* Is it legal to have static initializer blocks in EJB?
Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.
* Is it possible to stop the execution of a method before completion in a SessionBean?
Stopping the execution of a method inside a Session Bean is not possible without writing code inside the Session Bean. This is because you are not allowed to access Threads inside an EJB.
* What is the default transaction attribute for an EJB?
There is no default transaction attribute for an EJB. Section 11.5 of EJB v1.1 spec says that the deployer must specify a value for the transaction attribute for those methods having container managed transaction. In WebLogic, the default transaction attribute for EJB is SUPPORTS.
* What is the difference between session and entity beans? When should I use one or the other?
An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)
* Is there any default cache management system with Entity beans ? In other words whether a cache of the data in database will be maintained in EJB ?
Caching data from a database inside the Application Server are what Entity EJB’s are used for.The ejbLoad() and ejbStore() methods are used to synchronize the Entity Bean state with the persistent storage(database). Transactions also play an important role in this scenario. If data is removed from the database, via an external application - your Entity Bean can still be alive the EJB container. When the transaction commits, ejbStore() is called and the row will not be found, and the transaction rolled back.
* Why is ejbFindByPrimaryKey mandatory?
An Entity Bean represents persistent data that is stored outside of the EJB Container/Server. The ejbFindByPrimaryKey is a method used to locate and load an Entity Bean into the container, similar to a SELECT statement in SQL. By making this method mandatory, the client programmer can be assured that if they have the primary key of the Entity Bean, then they can retrieve the bean without having to create a new bean each time
which would mean creating duplications of persistent data and break the integrity of EJB.
* Why do we have a remove method in both EJBHome and EJBObject?
With the EJBHome version of the remove, you are able to delete an entity bean without first instantiating it (you can provide a PrimaryKey object as a parameter to the remove method). The home version only works for entity beans. On the other hand, the Remote interface version works on an entity bean that you have already instantiated. In addition, the remote version also works on session beans (stateless and stateful) to inform the container of your loss of interest in this bean.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is the difference between a Server, a Container, and a Connector?
An EJB server is an application, usually a product such as BEA WebLogic, that provides (or should provide) for concurrent client connections and manages system resources such as threads, processes, memory, database connections, network connections, etc. An EJB container runs inside (or within) an EJB server, and provides deployed EJB beans with transaction and security management, etc. The EJB container insulates an EJB bean from the specifics of an underlying EJB server by providing a simple, standard API between the EJB bean and its container. A Connector provides the ability for any Enterprise Information System (EIS) to plug into any EJB server which supports the Connector architecture. See Sun’s J2EE Connectors for more in-depth information on Connectors.
* How is persistence implemented in enterprise beans?
Persistence in EJB is taken care of in two ways, depending on how you implement your beans: container managed persistence (CMP) or bean managed persistence (BMP) For CMP, the EJB container which your beans run under takes care of the persistence of the fields you have declared to be persisted with the database - this declaration is in the deployment descriptor. So, anytime you modify a field in a CMP bean, as soon as the method you have executed is finished, the new data is persisted to the database by the container. For BMP, the EJB bean developer is responsible for defining the persistence routines in the proper places in the bean, for instance, the ejbCreate(), ejbStore(), ejbRemove() methods would be developed by the bean developer to make calls to the database. The container is responsible, in BMP, to call the appropriate method on the bean. So, if the bean is being looked up, when the create() method is called on the Home interface, then the container is responsible for calling the ejbCreate() method in the bean, which should have functionality inside for going to the database and looking up the data.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
* Is method overloading allowed in EJB?
Yes you can overload methods
* Should synchronization primitives be used on bean methods?
No. The EJB specification specifically states that the enterprise bean is not allowed to use thread primitives. The container is responsible for managing concurrent access to beans at runtime.
* Are we allowed to change the transaction isolation property in middle of a transaction?
No. You cannot change the transaction isolation level in the middle of transaction.
* For Entity Beans, What happens to an instance field not mapped to any persistent storage, when the bean is passivated?
The specification infers that the container never serializes an instance of an Entity bean (unlike stateful session beans). Thus passivation simply involves moving the bean from the ready to the pooled bin. So what happens to the contents of an instance variable is controlled by the programmer. Remember that when an entity bean is passivated the instance gets logically disassociated from it’s remote object. Be careful here, as the functionality of passivation/activation for Stateless Session, Stateful Session and Entity beans is completely different. For entity beans the ejbPassivate method notifies the entity bean that it is being disassociated with a particular entity prior to reuse or for dereference.
* What is a Message Driven Bean, what functions does a message driven bean have and how do they work in collaboration with JMS?
Message driven beans are the latest addition to the family of component bean types defined by the EJB specification. The original bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans will provide asynchrony to EJB based applications by acting as JMS message consumers. A message bean is associated with a JMS topic or queue and receives JMS messages sent by EJB clients or other beans. Unlike entity beans and session beans, message beans do not have home or remote interfaces. Instead, message driven beans are instantiated by the container as required. Like stateless session beans, message beans maintain no client-specific state, allowing the container to optimally manage a pool of message-bean instances. Clients send JMS messages to message beans in exactly the same manner as they would send messages to any other JMS destination. This similarity is a fundamental design goal of the JMS capabilities of the new specification. To receive JMS messages, message driven beans implement the javax.jms.MessageListener interface, which defines a single onMessage() method. When a message arrives, the container ensures that a message bean corresponding to the message topic/queue exists (instantiating it if necessary), and calls its onMessage method passing the client’s message as the single argument. The message bean’s implementation of this method contains the business logic required to process the message. Note that session beans and entity beans are not allowed to function as message beans.
* Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?
Yes. The JDK 1.2 support the dynamic class loading.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintainence is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is again up to the implementer.
* What is the advantage of putting an Entity Bean instance from the Ready State to Pooled state?
The idea of the Pooled State is to allow a container to maintain a pool of entity beans that has been created, but has not been yet synchronized or assigned to an EJBObject. This mean that the instances do represent entity beans, but they can be used only for serving Home methods (create or findBy), since those methods do not relay on the specific values of the bean. All these instances are, in fact, exactly the same, so, they do not have meaningful state. Jon Thorarinsson has also added: It can be looked at it this way: If no client is using an entity bean of a particular type there is no need for cachig it (the data is persisted in the database). Therefore, in such cases, the container will, after some time, move the entity bean from the Ready State to the Pooled state to save memory. Then, to save additional memory, the container may begin moving entity beans from the Pooled State to the Does Not Exist State, because even though the bean’s cache has been cleared, the bean still takes up some memory just being in the Pooled State.
* Can a Session Bean be defined without ejbCreate() method?
The ejbCreate() methods is part of the bean’s lifecycle, so, the compiler will not return an error because there is no ejbCreate() method. However, the J2EE spec is explicit: the home interface of a Stateless Session Bean must have a single create() method with no arguments, while the session bean class must contain exactly one ejbCreate() method, also without arguments. Stateful Session Beans can have arguments (more than one create method) stateful beans can contain multiple ejbCreate() as long as they match with the home interface definition. You need a reference to your EJBObject to startwith. For that Sun insists on putting a method for creating that reference (create method in the home interface). The EJBObject does matter here. Not the actual bean.
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it IS possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice (1) in terms of object oriented design. This is because you are creating an unnecessary coupling between back-end objects (ejbs) and front-end objects (HttpSession). Create a higher-level of abstraction for your ejb’s api. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your ejb needs to support a non-http-based client. This higher level of abstraction will be flexible enough to support it. (1) Core J2EE design patterns (2001)
* Is there any way to read values from an entity bean without locking it for the rest of the transaction (e.g. read-only transactions)? We have a key-value map bean which deadlocks during some concurrent reads. Isolation levels seem to affect the database only, and we need to work within a transaction.
The only thing that comes to (my) mind is that you could write a ‘group accessor’ - a method that returns a single object containing all of your entity bean’s attributes (or all interesting attributes). This method could then be placed in a ‘Requires New’ transaction. This way, the current transaction would be suspended for the duration of the call to the entity bean and the entity bean’s fetch/operate/commit cycle will be in a separate transaction and any locks should be released immediately. Depending on the granularity of what you need to pull out of the map, the group accessor might be overkill.
* What is the difference between a Coarse Grained Entity Bean and a Fine Grained Entity Bean?
A ‘fine grained’ entity bean is pretty much directly mapped to one relational table, in third normal form. A ‘coarse grained’ entity bean is larger and more complex, either because its attributes include values or lists from other tables, or because it ‘owns’ one or more sets of dependent objects. Note that the coarse grained bean might be mapped to a single table or flat file, but that single table is going to be pretty ugly, with data copied from other tables, repeated field groups, columns that are dependent on non-key fields, etc. Fine grained entities are generally considered a liability in large systems because they will tend to increase the load on several of the EJB server’s subsystems (there will be more objects exported through the distribution layer, more objects participating in transactions, more skeletons in memory, more EJB Objects in memory, etc.)
* What is EJBDoclet?
EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.
Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules of the Java language.
* Is it legal to have static initializer blocks in EJB?
Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.
* Is it possible to stop the execution of a method before completion in a SessionBean?
Stopping the execution of a method inside a Session Bean is not possible without writing code inside the Session Bean. This is because you are not allowed to access Threads inside an EJB.
* What is the default transaction attribute for an EJB?
There is no default transaction attribute for an EJB. Section 11.5 of EJB v1.1 spec says that the deployer must specify a value for the transaction attribute for those methods having container managed transaction. In WebLogic, the default transaction attribute for EJB is SUPPORTS.
* What is the difference between session and entity beans? When should I use one or the other?
An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)
* Is there any default cache management system with Entity beans ? In other words whether a cache of the data in database will be maintained in EJB ?
Caching data from a database inside the Application Server are what Entity EJB’s are used for.The ejbLoad() and ejbStore() methods are used to synchronize the Entity Bean state with the persistent storage(database). Transactions also play an important role in this scenario. If data is removed from the database, via an external application - your Entity Bean can still be alive the EJB container. When the transaction commits, ejbStore() is called and the row will not be found, and the transaction rolled back.
* Why is ejbFindByPrimaryKey mandatory?
An Entity Bean represents persistent data that is stored outside of the EJB Container/Server. The ejbFindByPrimaryKey is a method used to locate and load an Entity Bean into the container, similar to a SELECT statement in SQL. By making this method mandatory, the client programmer can be assured that if they have the primary key of the Entity Bean, then they can retrieve the bean without having to create a new bean each time
which would mean creating duplications of persistent data and break the integrity of EJB.
* Why do we have a remove method in both EJBHome and EJBObject?
With the EJBHome version of the remove, you are able to delete an entity bean without first instantiating it (you can provide a PrimaryKey object as a parameter to the remove method). The home version only works for entity beans. On the other hand, the Remote interface version works on an entity bean that you have already instantiated. In addition, the remote version also works on session beans (stateless and stateful) to inform the container of your loss of interest in this bean.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is the difference between a Server, a Container, and a Connector?
An EJB server is an application, usually a product such as BEA WebLogic, that provides (or should provide) for concurrent client connections and manages system resources such as threads, processes, memory, database connections, network connections, etc. An EJB container runs inside (or within) an EJB server, and provides deployed EJB beans with transaction and security management, etc. The EJB container insulates an EJB bean from the specifics of an underlying EJB server by providing a simple, standard API between the EJB bean and its container. A Connector provides the ability for any Enterprise Information System (EIS) to plug into any EJB server which supports the Connector architecture. See Sun’s J2EE Connectors for more in-depth information on Connectors.
* How is persistence implemented in enterprise beans?
Persistence in EJB is taken care of in two ways, depending on how you implement your beans: container managed persistence (CMP) or bean managed persistence (BMP) For CMP, the EJB container which your beans run under takes care of the persistence of the fields you have declared to be persisted with the database - this declaration is in the deployment descriptor. So, anytime you modify a field in a CMP bean, as soon as the method you have executed is finished, the new data is persisted to the database by the container. For BMP, the EJB bean developer is responsible for defining the persistence routines in the proper places in the bean, for instance, the ejbCreate(), ejbStore(), ejbRemove() methods would be developed by the bean developer to make calls to the database. The container is responsible, in BMP, to call the appropriate method on the bean. So, if the bean is being looked up, when the create() method is called on the Home interface, then the container is responsible for calling the ejbCreate() method in the bean, which should have functionality inside for going to the database and looking up the data.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
* Is method overloading allowed in EJB?
Yes you can overload methods
* Should synchronization primitives be used on bean methods?
No. The EJB specification specifically states that the enterprise bean is not allowed to use thread primitives. The container is responsible for managing concurrent access to beans at runtime.
* Are we allowed to change the transaction isolation property in middle of a transaction?
No. You cannot change the transaction isolation level in the middle of transaction.
* For Entity Beans, What happens to an instance field not mapped to any persistent storage, when the bean is passivated?
The specification infers that the container never serializes an instance of an Entity bean (unlike stateful session beans). Thus passivation simply involves moving the bean from the ready to the pooled bin. So what happens to the contents of an instance variable is controlled by the programmer. Remember that when an entity bean is passivated the instance gets logically disassociated from it’s remote object. Be careful here, as the functionality of passivation/activation for Stateless Session, Stateful Session and Entity beans is completely different. For entity beans the ejbPassivate method notifies the entity bean that it is being disassociated with a particular entity prior to reuse or for dereference.
* What is a Message Driven Bean, what functions does a message driven bean have and how do they work in collaboration with JMS?
Message driven beans are the latest addition to the family of component bean types defined by the EJB specification. The original bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans will provide asynchrony to EJB based applications by acting as JMS message consumers. A message bean is associated with a JMS topic or queue and receives JMS messages sent by EJB clients or other beans. Unlike entity beans and session beans, message beans do not have home or remote interfaces. Instead, message driven beans are instantiated by the container as required. Like stateless session beans, message beans maintain no client-specific state, allowing the container to optimally manage a pool of message-bean instances. Clients send JMS messages to message beans in exactly the same manner as they would send messages to any other JMS destination. This similarity is a fundamental design goal of the JMS capabilities of the new specification. To receive JMS messages, message driven beans implement the javax.jms.MessageListener interface, which defines a single onMessage() method. When a message arrives, the container ensures that a message bean corresponding to the message topic/queue exists (instantiating it if necessary), and calls its onMessage method passing the client’s message as the single argument. The message bean’s implementation of this method contains the business logic required to process the message. Note that session beans and entity beans are not allowed to function as message beans.
* Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?
Yes. The JDK 1.2 support the dynamic class loading.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintainence is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is again up to the implementer.
* What is the advantage of putting an Entity Bean instance from the Ready State to Pooled state?
The idea of the Pooled State is to allow a container to maintain a pool of entity beans that has been created, but has not been yet synchronized or assigned to an EJBObject. This mean that the instances do represent entity beans, but they can be used only for serving Home methods (create or findBy), since those methods do not relay on the specific values of the bean. All these instances are, in fact, exactly the same, so, they do not have meaningful state. Jon Thorarinsson has also added: It can be looked at it this way: If no client is using an entity bean of a particular type there is no need for cachig it (the data is persisted in the database). Therefore, in such cases, the container will, after some time, move the entity bean from the Ready State to the Pooled state to save memory. Then, to save additional memory, the container may begin moving entity beans from the Pooled State to the Does Not Exist State, because even though the bean’s cache has been cleared, the bean still takes up some memory just being in the Pooled State.
* Can a Session Bean be defined without ejbCreate() method?
The ejbCreate() methods is part of the bean’s lifecycle, so, the compiler will not return an error because there is no ejbCreate() method. However, the J2EE spec is explicit: the home interface of a Stateless Session Bean must have a single create() method with no arguments, while the session bean class must contain exactly one ejbCreate() method, also without arguments. Stateful Session Beans can have arguments (more than one create method) stateful beans can contain multiple ejbCreate() as long as they match with the home interface definition. You need a reference to your EJBObject to startwith. For that Sun insists on putting a method for creating that reference (create method in the home interface). The EJBObject does matter here. Not the actual bean.
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it IS possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice (1) in terms of object oriented design. This is because you are creating an unnecessary coupling between back-end objects (ejbs) and front-end objects (HttpSession). Create a higher-level of abstraction for your ejb’s api. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your ejb needs to support a non-http-based client. This higher level of abstraction will be flexible enough to support it. (1) Core J2EE design patterns (2001)
* Is there any way to read values from an entity bean without locking it for the rest of the transaction (e.g. read-only transactions)? We have a key-value map bean which deadlocks during some concurrent reads. Isolation levels seem to affect the database only, and we need to work within a transaction.
The only thing that comes to (my) mind is that you could write a ‘group accessor’ - a method that returns a single object containing all of your entity bean’s attributes (or all interesting attributes). This method could then be placed in a ‘Requires New’ transaction. This way, the current transaction would be suspended for the duration of the call to the entity bean and the entity bean’s fetch/operate/commit cycle will be in a separate transaction and any locks should be released immediately. Depending on the granularity of what you need to pull out of the map, the group accessor might be overkill.
* What is the difference between a Coarse Grained Entity Bean and a Fine Grained Entity Bean?
A ‘fine grained’ entity bean is pretty much directly mapped to one relational table, in third normal form. A ‘coarse grained’ entity bean is larger and more complex, either because its attributes include values or lists from other tables, or because it ‘owns’ one or more sets of dependent objects. Note that the coarse grained bean might be mapped to a single table or flat file, but that single table is going to be pretty ugly, with data copied from other tables, repeated field groups, columns that are dependent on non-key fields, etc. Fine grained entities are generally considered a liability in large systems because they will tend to increase the load on several of the EJB server’s subsystems (there will be more objects exported through the distribution layer, more objects participating in transactions, more skeletons in memory, more EJB Objects in memory, etc.)
* What is EJBDoclet?
EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.
Java Web development interview questions
* Can we use the constructor, instead of init(), to initialize servlet? - Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* What Class.forName will do while loading drivers? - It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
* How to Retrieve Warnings? - SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* In the Servlet 2.4 specification SingleThreadModel has been deprecated, why? - Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level.
* What are stored procedures? How is it useful? - A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* How do I include static files within a JSP page? - Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* Why does JComponent have add() and remove() methods but Component does not? - because JComponent is a subclass of Container, and can contain other components and jcomponents.
* How can I implement a thread-safe JSP page? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* What Class.forName will do while loading drivers? - It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
* How to Retrieve Warnings? - SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* In the Servlet 2.4 specification SingleThreadModel has been deprecated, why? - Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level.
* What are stored procedures? How is it useful? - A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* How do I include static files within a JSP page? - Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* Why does JComponent have add() and remove() methods but Component does not? - because JComponent is a subclass of Container, and can contain other components and jcomponents.
* How can I implement a thread-safe JSP page? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.
Java Web development interview questions
Database, Networking, Java interview questions
* Can we use the constructor, instead of init(), to initialize servlet? - Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* What Class.forName will do while loading drivers? - It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
* How to Retrieve Warnings? - SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* In the Servlet 2.4 specification SingleThreadModel has been deprecated, why? - Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level.
* What are stored procedures? How is it useful? - A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* How do I include static files within a JSP page? - Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* Why does JComponent have add() and remove() methods but Component does not? - because JComponent is a subclass of Container, and can contain other components and jcomponents.
* How can I implement a thread-safe JSP page? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.
* Can we use the constructor, instead of init(), to initialize servlet? - Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* What Class.forName will do while loading drivers? - It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
* How to Retrieve Warnings? - SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* In the Servlet 2.4 specification SingleThreadModel has been deprecated, why? - Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level.
* What are stored procedures? How is it useful? - A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* How do I include static files within a JSP page? - Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* Why does JComponent have add() and remove() methods but Component does not? - because JComponent is a subclass of Container, and can contain other components and jcomponents.
* How can I implement a thread-safe JSP page? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.
Web Application Developers - Jobs Questions
Following are the questions from an interview I attended for in C#, ASP.NET, XML and Sql Server. I will try to add some more as soon as I recollect. Hope these questions will be useful for people attending interviews in this area.
* What is the maximum length of a varchar field in SQL Server?
* How do you define an integer in SQL Server?
* How do you separate business logic while creating an ASP.NET application?
* If there is a calendar control to be included in each page of your application, and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and very page of your application?
* How do you debug an ASP.NET application?
* How do you deploy an ASP.NET application?
* Name a few differences between .NET application and a Java application?
* Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
* What are the XML files that are important in developing an ASP.NET application?
* What is XSLT and what is its use?
* What is the maximum length of a varchar field in SQL Server?
* How do you define an integer in SQL Server?
* How do you separate business logic while creating an ASP.NET application?
* If there is a calendar control to be included in each page of your application, and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and very page of your application?
* How do you debug an ASP.NET application?
* How do you deploy an ASP.NET application?
* Name a few differences between .NET application and a Java application?
* Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
* What are the XML files that are important in developing an ASP.NET application?
* What is XSLT and what is its use?
Jakarta struts questions
A reader sent it a set of Jakarta Struts questions used at his company.
* What is Jakarta Struts Framework?
Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.
* What is ActionServlet?
The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.
* How you will make available any Message Resources Definitions file to the Struts Framework Environment?
Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through tag.
Example:
* What is Action Class?
The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.
* Write code of any Action Class?
Here is the code of Action Class that returns the ActionForward object.
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class TestAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
return mapping.findForward("testAction");
}
}
* What is ActionForm?
An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.
* What is Struts Validator Framework?
Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class. The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.
* Give the Details of XML files used in Validator Framework?
The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.
* How you will display validation fail errors on jsp page?
The following tag displays all the errors:
< html:errors / >
* How you will enable front-end validation based on the xml in validation.xml?
The < html:javascript > tag to allow front-end validation based on the xml in validation.xml. For example the code: generates the client side java script for the form logonForm as defined in the validation.xml file. The when added in the jsp file generates the client site validation script.
* What is Jakarta Struts Framework?
Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.
* What is ActionServlet?
The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.
* How you will make available any Message Resources Definitions file to the Struts Framework Environment?
Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through
Example:
* What is Action Class?
The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.
* Write code of any Action Class?
Here is the code of Action Class that returns the ActionForward object.
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class TestAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
return mapping.findForward("testAction");
}
}
* What is ActionForm?
An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.
* What is Struts Validator Framework?
Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class. The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.
* Give the Details of XML files used in Validator Framework?
The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.
* How you will display validation fail errors on jsp page?
The following tag displays all the errors:
< html:errors / >
* How you will enable front-end validation based on the xml in validation.xml?
The < html:javascript > tag to allow front-end validation based on the xml in validation.xml. For example the code:
Programming Job Questions
* How can you defined OOP?
* How can you use OOP in your projects/products/applications?
* What is copy constructor?
* How many types of copy constructor are there?
* What shallow copy constructor does/behaves?
* Does C++ support copy constructor?
* Does Java support copy constructor?
* (If the answer to the previous question was correct) Why doesn’t Java support copy constructor?
* What is software life cycle?
* How can you use OOP in your projects/products/applications?
* What is copy constructor?
* How many types of copy constructor are there?
* What shallow copy constructor does/behaves?
* Does C++ support copy constructor?
* Does Java support copy constructor?
* (If the answer to the previous question was correct) Why doesn’t Java support copy constructor?
* What is software life cycle?
IBM Interview
* I have a scale and 7 balls. 1 ball is heavier than all the rest. How do I determine the heaviest ball with only 3 possible weighing attempts?
* What is a linked list?
* Name an advantage of linked list over array?
* Name an advantage of array over linked list?
* Have you ever used threads?
* Should you protect the global data in threads? Why or why not?
* Have you ever interfaced with a database?
* Tell us about yourself.
* Questions about specific resume entries.
* Given two strings like x=hello and y=open, remove any character from string x which is also used in string y, thus making the result x=hll.
* What is a linked list?
* Name an advantage of linked list over array?
* Name an advantage of array over linked list?
* Have you ever used threads?
* Should you protect the global data in threads? Why or why not?
* Have you ever interfaced with a database?
* Tell us about yourself.
* Questions about specific resume entries.
* Given two strings like x=hello and y=open, remove any character from string x which is also used in string y, thus making the result x=hll.
EJB Job Questions
* What are the different kinds of enterprise beans?
Different kind of enterrise beans are Stateless session bean, Stateful session bean, Entity bean, Message-driven bean.
* What is Session Bean?
A session bean is a non-persistent object that implements some business logic running on the server. One way to think of a session object.
* What is Entity Bean?
The entity bean is used to represent data in the database. It provides an object-oriented interface to ____.
* What are the methods of Entity Bean?
An entity bean consists of 4 groups of methods, create methods.
* What is the difference between Container-Managed Persistent (CMP) bean and Bean-Managed Persistent(BMP) ?
Container-managed persistence (CMP) and bean-managed persistence (BMP). With CMP, the container manages the persistence of the entity bean.
* What are the callback methods in Entity beans?
Callback methods allows the container to notify the bean of events in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.
* What is software architecture of EJB?
Session and Entity EJBs consist of 4 and 5 parts respectively, a remote interface.
* Can Entity Beans have no create() methods?
Yes. In some cases the data is inserted NOT using Java application,.
* What is bean managed transaction?
If a developer doesn’t want a Container to manage transactions, it’s possible to implement all database operations manually.
* What are transaction attributes?
The transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean’s home or.
* What are transaction isolation levels in EJB?
Transaction_read_uncommitted, Transaction_read_committed, Transaction_repeatable_read.
Different kind of enterrise beans are Stateless session bean, Stateful session bean, Entity bean, Message-driven bean.
* What is Session Bean?
A session bean is a non-persistent object that implements some business logic running on the server. One way to think of a session object.
* What is Entity Bean?
The entity bean is used to represent data in the database. It provides an object-oriented interface to ____.
* What are the methods of Entity Bean?
An entity bean consists of 4 groups of methods, create methods.
* What is the difference between Container-Managed Persistent (CMP) bean and Bean-Managed Persistent(BMP) ?
Container-managed persistence (CMP) and bean-managed persistence (BMP). With CMP, the container manages the persistence of the entity bean.
* What are the callback methods in Entity beans?
Callback methods allows the container to notify the bean of events in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.
* What is software architecture of EJB?
Session and Entity EJBs consist of 4 and 5 parts respectively, a remote interface.
* Can Entity Beans have no create() methods?
Yes. In some cases the data is inserted NOT using Java application,.
* What is bean managed transaction?
If a developer doesn’t want a Container to manage transactions, it’s possible to implement all database operations manually.
* What are transaction attributes?
The transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean’s home or.
* What are transaction isolation levels in EJB?
Transaction_read_uncommitted, Transaction_read_committed, Transaction_repeatable_read.
EJB Tough Interview Job Questions
* How EJB Invocation happens?
Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is, again, up to the implementer.
* Can the primary key in the entity bean be a Java primitive type such as int?
The primary key can’t be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).
* Can you control when passivation occurs?
The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).
* What is the advantage of using Entity bean for database operations, over directly using JDBC API to do database operations? When would I use one over the other?
Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor). In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container.
* What is EJB QL?
EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.
* Brief description about local interfaces?
EEJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.
* What are the special design care that must be taken when you work with local interfaces?
It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference. This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.
* What happens if remove( ) is never invoked on a session bean?
In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container. In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.
* What is the difference between Message Driven Beans and Stateless Session beans?
In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is, again, up to the implementer.
* Can the primary key in the entity bean be a Java primitive type such as int?
The primary key can’t be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).
* Can you control when passivation occurs?
The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).
* What is the advantage of using Entity bean for database operations, over directly using JDBC API to do database operations? When would I use one over the other?
Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor). In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container.
* What is EJB QL?
EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.
* Brief description about local interfaces?
EEJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.
* What are the special design care that must be taken when you work with local interfaces?
It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference. This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.
* What happens if remove( ) is never invoked on a session bean?
In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container. In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.
* What is the difference between Message Driven Beans and Stateless Session beans?
In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
EJB Tough Interview Job Questions
* How EJB Invocation happens?
Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is, again, up to the implementer.
* Can the primary key in the entity bean be a Java primitive type such as int?
The primary key can’t be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).
* Can you control when passivation occurs?
The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).
* What is the advantage of using Entity bean for database operations, over directly using JDBC API to do database operations? When would I use one over the other?
Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor). In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container.
* What is EJB QL?
EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.
* Brief description about local interfaces?
EEJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.
* What are the special design care that must be taken when you work with local interfaces?
It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference. This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.
* What happens if remove( ) is never invoked on a session bean?
In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container. In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.
* What is the difference between Message Driven Beans and Stateless Session beans?
In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).
* Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
* The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is, again, up to the implementer.
* Can the primary key in the entity bean be a Java primitive type such as int?
The primary key can’t be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).
* Can you control when passivation occurs?
The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).
* What is the advantage of using Entity bean for database operations, over directly using JDBC API to do database operations? When would I use one over the other?
Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor). In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container.
* What is EJB QL?
EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.
* Brief description about local interfaces?
EEJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.
* What are the special design care that must be taken when you work with local interfaces?
It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference. This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.
* What happens if remove( ) is never invoked on a session bean?
In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container. In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.
* What is the difference between Message Driven Beans and Stateless Session beans?
In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.
* How can I call one EJB from inside of another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
* What is an EJB Context?
EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.
Subscribe to:
Posts (Atom)