PDA

View Full Version : Interview Questions for C++


BlrBoy
October 22nd, 2003, 06:47 AM
guys, My wife is attending an interview in tomorrow.. she has not done C++ for quite some time. Can any pundits of C++ tell me some of the Questions and Answers for C++

ShivSainik
October 22nd, 2003, 06:58 AM
I am sorry to discourage you, but if interviewer is good he/she can catch last time preps. I think 1 day is too less to even brush up C++ knowledge :(

Anyway if you can get this book, it will be very helpful :

C++ FAQ by Marshal Cline

Online version :
http://users.utu.fi/~sisasa/oasis/cppfaq/

And best of luck to ur wife :up:

baapji
October 22nd, 2003, 07:23 AM
Originally posted by BlrBoy
guys, My wife is attending an interview in tomorrow.. she has not done C++ for quite some time. Can any pundits of C++ tell me some of the Questions and Answers for C++

level bolo zara kis level ka interview hai
abhi programmer level hai to overloading aur overriding of operators and functions se lekar friend class encapsulation chalega mid level hai to abstraction se lekar live updates tak ka funda brush up kar lo aur agar server support main module lead tak ka chance hai to book se kuchh nahi hoyenga ghar par baith ke pooja karo aur pray karo ki koi ghodu interviewer ho jo sirf shakal dekh ke job de daale :D:D( no off. plz )

:cool:

echarcha
October 22nd, 2003, 09:19 AM
which can help you prepare for a C++ interview.


Question Bank 1 (http://www.cpuniverse.com/newsite/archives/1999/mar/c++.html)

Question Bank 2 (http://homepage.mac.com/edahand/iblog/B1323778479/C1489470417/E358004301/)

HOT interview questions on C++ fundamentals (http://www.geocities.com/alibagcity/articles/cppint.html)



Q: What is the keyword friend used for?
A: The key word friend is used to grant another class access to a classes private members.

Q: What is the value of x in the following code snippets
case 1:
void function (int& var)
{
var = 42;
}

int x = 0;
function (x);
// What is x? x is 42

case 2:
void function (int var)
{
var = 42;
}

int x = 0;
function (x);
// What is x? x is 0

case3:
void function (int* var)
{
*var = 42;
}

int x = 0;
function (&x);
// What is x? x is 42

Q: Why canít an class c1 be instantiated ?
class c1
{
void function1 () ;
void function2() = 0;
};

A: function2 is a pure virtual function and so c1 is an abstract and so it can not be instantiated.

Q: Does C++ support multiple inheritance is this a good thing?
A: Yes id does. People have different ideas about if languages
should use multiple inheritance. Most people agree that multiple
interface inheritance is needed by a language and multiple
interface inheritance is C++ís mechanism for providing multiple
interface inheritance.

Will get you more by end of the day. Hope these will help.

echarcha
October 22nd, 2003, 09:22 AM
which has some hints about how to answer questions.

http://www.duke.edu/web/ACM/interview.html

echarcha
October 22nd, 2003, 09:24 AM
Check this last one too

C/C++ Programming Tips and Interview Tips (http://cplus.about.com/library/tips/bltips.htm)

Diplomat
October 22nd, 2003, 09:30 AM
Q: What is the keyword friend used for?
A: The key word friend is used to grant another class access to a classes private members.


Now I understand why so many boys would like to make friend with girls :D

GunsNRoses
October 22nd, 2003, 09:49 AM
Echarcha-ji, one of the above questions is incorrect.

Q: Why canít an class c1 be instantiated ?
class c1
{
void function1 () ;
void function2() = 0;
};

A: Because you CAN'T compile the code :D. Correct code:
class c1
{
void function1 () ;
virtual void function2() = 0;
};


Just noticed that the answer for the last question is partly bogus too. C++ supports multiple inheritance and it is a topic that brings up a lot of discussion. The rest of the answer is totally bogus

echarcha
October 22nd, 2003, 09:51 AM
Originally posted by GunsNRoses
Echarcha-ji, one of the above questions is incorrect.

Q: Why canít an class c1 be instantiated ?
class c1
{
void function1 () ;
void function2() = 0;
};

A: Because you CAN'T compile the code :D. Correct code:
class c1
{
void function1 () ;
virtual void function2() = 0;
};



I just picked up some links I knew for BlrBoy yaar. Thanks for pointing out.