They take a C++ test, 4-6 candidates in a room, the test starts with introduction of the company. They give the part of code on which they have worked in any project etc, and questions related to that code. They expect you to understand the code to an extent that you can make simple changes to the code, the changes are not in fundamental parts i.e. in classes but they are in functions. they check how good you can debug the code. then after the code three questions are written :
1) this question is about a function trace() which prints something at beginning and end of main(), how does trace works? (the constructor and destructor of trace object works at the start and end of main)
2) difference between string &address and const string address
3) class foo()
{
void do()
{
cout<<"foo \n";
}
}
class bar : public foo
{
void do()
{
cout<<"bar \n";
}
}
void dosomething(foo f)
{
f.do();
}
main()
{
bar b;
b.dosomething();
}
what does the following print: 1) f.do(); 2) b.do 3) b.dosomething(); (here they want to get bar printed instead of foo, the concept of object slicing is used)