Folks,

I am an experienced developer and happend to attend the interview at yahoo India development centre.

The pity part is interviewers are coming with print outs of programs written on paper. So, It is often possible you can easily overlook some of the things on the paper. But that is the fact and be prepared...

Here we go:

Question 1:
========

class A()
{
A() : { func(); }

virtual void func() { cout << "in A " << endl; }
}

class B()
{

B();

virtual void func() { cout << "in B" << endl; }

}

main()
{
B b;
}

Question: What will be printed();

Question 2: (is there any problems with following programs?)

NOTE:- there may be mistake in my typing, but you can assume
that functions are correct.

=========

string& getAccount()
{
string str(15);
return str;
}

int getVectValue(int key, vector<string> vect)
{
int value = vect.getvalue(key);
return val;
}

string getStringValue(int size)
{
string tempstr[size];
switch(size)
{
case 1:
strcpy(tempstr, "ONE");
case 2:
strcpy(tempstr,"TWO");
}
return tempstr;
}

Question 3:
=========

I was asked to implement auto_ptr equivalent with templates.
There are several Smart Pointer classes out there, you can refer them

Question 4:
=========

I was asked to write a singleton pattern program. There was a lot of discussion went in around this.

Question 5:
===========

One guy asked me following question.

Can you implement garbage collector in C++ and how you do that?

It may be possible, but to be honest, if some body can do this, it would have
been already available. May that is the research they are doing.

Question 6:
==========

There was a discussion around how a unix program will be invoked and executed from shell.

I hope this give some insights into questions they are asking.

But beware, if they are honest about your recruitment, you will surely be asked what you are supposed to do as part of your job.

In my case, since they are asking about Garbage Collector in C++...well... by now, you know the outcome of interview .....


- Jason2010