Wednesday

Interview Questions with Answer

Hi Friends..
I have got one more good topic about Interview Questions & tricks of how to answer them.
I hope u all like it..

Sample Interview Questions: How will you answer?

Your career may depend on it...
  • Tell me about yourself... (Your answer should contain much more about your job skills than your personal life.) Talk about the growth of your career, what you learned from previous employment or even things like how your volunteer worked help you develop your organizational, time management and leadership skills.
  • What are your strengths? (If you really enjoy new challenges and tackle them in an organized manner, this would be a useful strength in almost any situation.) You can talk about your ability to find unique solutions to problems. Be prepared with some concrete examples, since that may be the follow-up question.
  • What are your weaknesses? (A "good" weakness might be that you have trouble leaving the office behind when you go home in the evenings.) This is a very difficult question that is not asked often, but it's one you should prepare for anyway. If you talk about your temper, your tendency to gossip or the fact that you're lazy, you may as well pack up and go home right then. If you mention a weakness such as your lack of patience with people who don't do their share of the work, you should also mention that you keep this impatience to yourself and try very hard not to express it toward others.
  • Do you have any questions about our company? (If you have paid attention during the interview and if you have done your homework, this would be a good time to ask for more details about some aspect of the company's organizational structure or products. It would not be a good time to ask about your first raise. You could also ask questions about the community, their training program or details about the work environment.)
  • Where do you expect your career to be in 10 years? (Be careful here. You do not want to give the impression that you're simply using this company as a stepping stone to another career. Think of a related managerial position within the company that would interest you.) There is a story about a young accountant who was asked this question by a CPA firm during an interview. The young accountant replied that he saw himself as the comptroller of a large corporation. In other words, "I'm just using your firm to teach me and then after you spend your resources training me, I will leave to go work for someone else." Needless to say, he was not offered a position with the CPA firm. They know that 75% of the people they hire will leave within 10 years, but they do not want to hire someone who comes in with that plan.
  • What skills do you have that would benefit our company? (If your skills are not exactly those that the company may have requested, you can point out the skills you have that would be valuable to any company. Examples of these skills are: your ability to plan and execute long-term projects, your ability to organize information into usable data, your ability to research complicated issues, or your ability to work well with a team.) If your skills are not perfect for this particular company, you can mention how quickly you were able to adapt and learn in other situations. Again, be prepared with specific examples in case you are asked to elaborate.
  • Why did you leave your last job? (This is not an opening to speak badly of your former employer. There is almost always a way of wording the explanation so that you do not sound like a "problem employee" and your former employer does not sound like an undesirable company.) As unfair as it may seem, there is almost no time when you should say something bad about your former employer. You can talk about the lack of potential for upward mobility, the fact that your job responsibilities changed to the point that it no longer fit into your career plan, your need to move to be closer to your aging parents, the need to reduce travel time, your need for a more challenging job, or anything else that does not get into personalities or other conflicts. If you were fired for cause, you may want to be up front about it, explain the circumstances and accept responsibility for your actions. Practice your answers to this question with someone who has interview experience. However, don't lie. If you can't say anything positive about your former employer, don't say anything. It could come back to haunt you.
IMPORTANT INTERVIEW TIPS:
  1. Arrive a little early. If you arrive about fifteen minutes before the scheduled interview time, you will have time to collect your thoughts, wipe the perspiration from your hands, and scan the lobby for current company information. You will also show your interviewer that you value his or her time.
  2. Do your homework. Know the interviewer's name and how to pronounce it (including proper title: Mr., Mrs., Dr., etc.). Know the company's major products or services, the organization of the company (divisions, parent company, etc.), current business news about the company and the company's major customers and competitors. You can learn most or all of this information from the company's website, annual report or company literature.
  3. Bring a Spare Copy of Your Resume in a Briefcase or Folder. This demonstrates that you are prepared. It also gives the interviewer something to take notes on.
  4. Expect to Spend Some Time Developing Rapport. Personal chemistry is a main ingredient in the hiring process. Try to relax and become comfortable with the interviewer.
  5. Watch Your Non-Verbal Communication. Maintain an open body posture and appropriate eye contact. Seat yourself at a reasonable distance from the other person. Smile.
  6. Don't Be Embarrassed by Nervousness. Interviewers are human, and they often become nervous, too. In fact, nervousness is a good sign - it shows that you are taking the interview seriously. Avoid nervous mannerisms such as tapping your fingers, feet, playing with pens, etc.
  7. Body language is powerful! Good eye contact, a warm, natural smile and a firm handshake can help you overcome nervousness, develop a personal rapport and present a confident image.
  8. Don't Play Comedian or Try to Entertain the Interviewer. It is important to be personable, but do not overdo it.
  9. Don't Exaggerate or Lie. You might be tempted to embellish your achievements in the interview, but it will come back to haunt you on the job!
  10. Follow the Interviewer's Lead. Don't try to take over the interview. Stick to the main subject at hand, but do not dwell too long on one point. It is better to deal with many questions rather than just one or two in-depth questions, unless that's where the interviewer leads you.
  11. Be Prepared For Personal Questions, Even Some Inappropriate Ones. Anticipate how you will handle personal questions without blowing your cool. Some interviewers may not be aware of what they can and cannot legally ask you. Be sure you understand the question. It is okay to ask for clarification.
  12. Emphasize the Positive. Be frank and honest, but never apologize for lack of experience or weaknesses. You can be self-confident without being overconfident or flippant. If you are new to the job market, your lack of experience has one very positive feature: you do not have to "unlearn" bad habits or different practices learned from previous employers. Many employers like the idea that you can be taught their individual company procedures without needing to get rid of other training first.
  13. Wait for an Offer to Bring Up Salary. Let the interviewer bring up this subject. Often salary and benefits are not discussed at all on the first interview. Even though everyone knows that salary is important, you do not want to give the impression that it is the only consideration. If it is, you can be easily lured away be a competitor offering a slightly higher salary. The interviewer needs to see that you are interested in the other aspects of the job like the potential for growth, learning or the challenge of the position.
  14. Don't be Afraid to Think Before You Speak. Use silence and intentional pause to your advantage. Time is occasionally needed to think and to reflect. The interviewer will respect you for taking a questions seriously enough to give it a moment or two of consideration before answering.
  15. Emphasize What You Can Do For The Organization. This means emphasizing your transferable skills. However, be careful not to reveal trade secrets from a previous employer. Employers are concerned most with what you can do for them. Focus on your ability to tackle new situations, your communication skills, interpersonal abilities, analytical thinking talents, and other skills developed while in college or in previous positions.
  16. Don't give "Prepared Answers". Most employers know a these stock answers when they hear them. This is a good reason to use interview question / answer guide as just that - guides. If your answers are not personalized to your situation, they will sound forced and unnatural. You might be surprised to learn how often interviewers hear the phrase, "I really like working with people." The phrase is used so often that it has lost it's meaning!
  17. NEVER Speak Badly about a Former Employer. If there were problems with previous experiences, try to put your answers in the positive rather than the negative. If you slight a former employer, the interviewer may assume that you will someday do the same to him or her.
  18. Watch Your Grammar and Your Manners. Employers are interested in candidates who can express themselves properly. Even if you have to slow down to correct yourself -- do it! Use slang expressions very sparingly. If your knowledge of rules of etiquette are rusty, take a "refresher course" from a knowledgeable friend.
  19. Be Prepared to Ask Questions. Almost all interviewers will ask if you have any questions. You should have some ready and should have at least one that is related to the conversation you have just completed. This demonstrates that you are both prepared and interested. Your questions should be related to details about the company and should be based on the information you learned from the homework you have done (see Tip #2). You should not ask questions like "How long to I have to wait before I can take a vacation?" Save those what's-in-it-for-me questions for later.
  20. Use Telephone Interviews. If you are applying for jobs in places in other states, you can suggest a short telephone interview. Even a preliminary telephone interview can help you assess whether or not it would be worth your time and expense to travel for a personal interview.
  21. Don't Expect an Immediate Job Offer. Offers usually follow the interview, a few weeks later. If you are offered the position on the spot, it is appropriate for you to ask for one or two days to think about the offer before responding.
  22. Be Careful With the Closing. Do not linger. End quickly and courteously. Thank your interviewer for the interview. Smile.
  23. Be Yourself! You do not want to get hired on the basis of something you are not. You want to be hired for who you are!
I Hope this is useful.
Wish u all the best & God Bless u all _________

C & C++ Questions with Answers

##################################################
1. QUESTIONS
##################################################

1. * In C++, what is the difference between method overloading and method overwriting?
2. * In C, why is the void pointer useful?
3. What are the differences between a C++ struct and C++ class?
4. How many ways are there to initialize an int with a constant?

5. What is the difference between a copy constructor and an overloaded assignment operator?

6. How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

7. What's wrong with "char *p; *p = malloc (10);"?

8. Reversing a linked list. Given a linked list, reverse it. Input must be read from a file, "list.dat". It will just be a list of integers. The total number is not known. The program should create a linked list with the given numbers in the same order. Each node contains the value and a pointer to the next node of the list. Defining just TWO additional node pointers you must inverse the given list and print out the numbers in the list. NO OTHER VARIABLE of any type should be defined. Hence the output will be reverse of the input. e.g. Input file reads, 3 1 4 2 Linked list will be, Head -> 3 -> 1 -> 4 -> 2 -> Null the reversed list must be, Null <- 3 <- 1 <- 4 <- 2 <- Head So the output will be, 2,4,1,3. 9. main () { int i; fork (); fork (); printf ("----"); fork (); printf ("----"); } How many times the printf will be executed? 10. Give the output of the following program main () {char *s; s="hot java"; strcpy (s,"solarrs java") }

11. Give the output of the following program
main ()
{printf ("hot java");
fork ()
exit (0);
}
(i). When redirected to a screen what will be printed.
(ii). When redirected to file what will be printed.

12. Find the error in the following program
struct point
{struct point *next;
int data;
}
x;
main ()
{int i;
for (x=p;x!=0;)
x=x->next,x++;
freelist (x);
}
freelist (x)
{free (x);
return
}


13. When does a stack member will be initialized?
(a) When object is created (b) when object is initialized.
(c) doesn’t depend on object. (d) None.

14. Point out the error, if any, in the following program
main ()
{
int a=10, b;
a>= 5? b=100: b=200;
printf ("\n %d", b);
}

15. What is the difference between the following declarations?
const char *s;
char const *s;

16. What is the difference between the following declarations?
const char *const s; char const *const s;

17. Point out the error in the following program
main ()
{
const char *fun ();
*fun ()='A';
}
const char *fun ()
{
return "Hello";
}

18. Given a macro like #define MAX (A, B) {to return that is larger} what will MAX (i++, j), MAX (i, j++) return


19. Which holds true for the following statement
class c: public A, public B
a) 2 member in class A, B should not have same name
b) 2 member in class A, C should not have same name
c) both d) none

20. Find MAXIMUM of three distinct integers using a single C statement

21. Write a general swap macro in C:
- A macro, which can swap any type of data (i.e. int, char, float, struct, etc…)

22. Write a program to delete the entry from the doubly linked list without saving any of the entries of the list to the temporary variable.

##################################################
1. ANSWERS
##################################################

1. Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overwriting is the ability of the inherited class rewriting the virtual method of the base class.

2. The void pointer is useful because it is a generic pointer that any pointer can be cast into and back again without loss of information.

3. The default member and base-class access specifiers are different.

This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifiers, member functions, overloaded operators, and so on. Some of them have even written books about C++. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specifier and private base-class inheritance. Getting this question wrong does not necessarily disqualify an applicant. Getting it right is a definite plus.

4. Two.

There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.

int foo = 123;

int bar (123);

It's acceptable when a programmer does not know about the second notation, although they should certainly know about the first one. Many old-timer C programmers who made the switch to C++ never use the second idiom, although some wise heads of C++ profess to prefer it. If your applicant is quick with the right answer, that's a good sign.

5. A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

6. No solution available

7. No solution available

8. Reversing a linked list. Simple. Use two new pointer p, q and the head that’s already available. Invert the first three nodes and keep iterating along the list. Else use recursion.

9-13 Answers/Solutions not available

14. lvalue required in function main (). The second assignment should be written in parenthesis as follows:
a>= 5 ? b=100: (b=200);
15. No Difference

16. No Difference

17. fun() returns to a "const char" pointer which cannot be modified

19. (a)

20. d= (a>b)? ((a>c)? a: c)) : ((b>c)? b: c))

##################################################
2.QUESTIONS
##################################################

1. Base class has some virtual method and derived class has a method with the same name. If we initialize the base class pointer with derived object; calling of that virtual method will result in which method being called?
a. Base method b. Derived method.
c. Error d. None of these

2. Given below are two sets of statements:(a) & (b). Select the correct observation:
a> const char *p="Hello"; p="World";
b> char * const p="Hello"; p[1]='P';
A. Both a & b are correct since non-const data/pointer is being changed in both cases.
B. Both a & b are wrong since const data/pointer cannot be changed once assigned.
C. a is correct, b is wrong.
D. a is wrong, b is correct.

3. void main ()
{
"Bunka"[2]='P';
}
Select the correct statement:
A. Error: lvalue required
B. Error: A string literal is a const char * and hence cannot be modified directly.
C. A string literal has the data type char * and hence cannot be modified.
D. The code compiles but memory access error at run-time.

4. Select all the correct statements about "Abstraction"
A. Assumes essential characteristics of an object to distinguish it from other kinds of objects.
B. Provides a simplified view of the object.
C. It separates the implementation from its interface.
D. It is the enforcement of the type class of an object.
5. The behavior of a class is decided by
A. Data members. B. Methods. C. Access permissions. D. All of the above.
6. Which statement(s) is/are true about "Static Typing"?
A. Refers to Types declared at compile time.
B. More efficient and reliable than dynamic typing.
C. Can be used to implement polymorphism.
D. Refers to all static data/methods in your classes.
7. Which statements(s) is/are true about Dynamic binding?
A. The correct function to call is resolved at run-time.
B. These functions are statically typed.
C. These functions are dynamically typed.
D. Refers to all dynamically allocated data in your classes.
8. Reusability of objects is achieved by
A. Inheritance. B. Aggregation. C. Polymorphism. D. All of the above.
9. Which statements(s) is/are true about "Hierarchy" of objects?
A. It is an ordering of abstractions.
B. It refers to "is a " relationship expressed by inheritance.
C. It refers to "has a" relationship expressed by aggregation.
D. It refers to access permissions on the aggregated object within an object.
10. What are "Generic classes"? (Select all that are correct)
A. A universal base class to cater to a wide range of derived classes.
B. A parameterized class, which is reusable across, types.
C. Used where implementation and behavior is independent of type.
D. Also known as abstract classes.
11. A language is "Object Base" if (Select all that are correct)
A. It supports abstraction. B. It has a concept of class.
C. It provides direct support for inheritance. D. All of the above.
12. "Object Persistence" covers which of the following (Select all that are correct)
A. Global variables & heap items. B. Object data storage.
C. Object type storage. D. All of the above.
13. Which statement(s) is/are true about shared inheritance?
A. All base classes are by default example of shared inheritance.
B. In multiple inheritances the derived classes share a single instance of the Base Class.
C. The base class is declared dynamically & there can be only one instance of it.
D. It allows distributed objects to share remote object and treat it as their own.

14. void f (int y)
{
struct s *ptr;
ptr = malloc (size of (struct)+99*size of (int));
}
struct s
{
int i;
float p;
};
when free (ptr) is executed, what will happen?
15. . Using pointer, changing A to B and B to A is swapping the function using two addresses and one temporary variable. a, b are address, t is temporary variable. How function look like?
16. Write a c program to find whether a stack is progressing in forward or reverse direction.
17. What is the output of the following program?
void main ()
{
char *ptr1="DCM0DAT\0ASYSTEMS";
clrscr ();
printf ("%d %s ", strlen (ptr1),ptr1);
printf ("%d %s ",strlen (ptr1+8),ptr1+8);
getch ();
}
18. How do you declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
19. void main ()
{
char *s []={“dharma", "hewlett-packard", "siemens", "ibm"};
char **p;
p=s;
printf ("%s", ++*p);
printf ("%s", *p++);
printf ("%s", ++*p);
}
20. Which holds true for the following statement
class c: public A, public B
a) 2 member in class A, B should not have same name
b) 2 member in class A, C should not have same name
c) both
d) none
21. Given the following c program
func (int *i, int*j)
{*i=*i * *i;
*j=*j* *j;
}
main ()
{ int i = 5, j = 2;
func (&i, &amp;j);
printf ("%d %d", i, j);
}
What is the output?
22. For the following C program
void insert (key, r)
type key key, data array r;
{extern int n;
if (n>=max) _/*error table if full */
else r [n++]. k=key;
}
This on executing, enables a
a) Basic sequential search b) Binary search c) Interpolation search d) None
23. f (char *p)
{
p [0]? f (++p): 1;
printf ("%c", *p);
}
if call that function with f (Aabcd) what is the output??
24 In a class only declaration of the function is there but definition is not there then what is that function ?
25 What is the use of global static variable in C?

##################################################
2. ANSWERS
##################################################

1 (b)
15 swap (int *, int *, int)
18 The first part of this question can be answered in at least three ways:
a). char *(*(*a [N]) ())();
b) Build the declaration up incrementally, using typedefs:
typedef char *pc; _/* pointer to char */
typedef pc fpc (); _/* function returning pointer to char */
typedef fpc *pfpc; _/* pointer to above */
typedef pfpc fpfpc (); _/* function returning... */
typedef fpfpc *pfpfpc; _/* pointer to... */
pfpfpc a [N]; _/* array of... */
c) Use the cdecl program, which turns English into C and vice versa:
cdecl> declare a as array of pointer to function returning pointer to function returning pointer to char
char *(*(*a []) ())()
cdecl can also explain complicated declarations, help with casts, and indicate which set of parentheses the arguments go in (for complicated function definitions, like the one above).
Any good book on C should explain how to read these complicated C declarations "inside out" to understand them ("declaration mimics use").
The pointer-to-function declarations in the examples above have not included parameter type information. When the parameters have complicated types, declarations can *really* get messy. (Modern versions of cdecl can help here, too.)
19. "harma" (p->add (dharma) &&amp; (*p)->harma)
"harma" (after printing, p->add (hewlett-packard) &&(*p)->harma)
"ewlett-packard"
20. (a)
23. dcbaA (Just reversing the string)
24. virtual function


I hope this is useful._______________________