| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| What is the difference between operator new and the new
operator? | Wipro | 1 |
| Explain about profiling? | | 1 |
| Can inline functions have a recursion? Give the reason? | | 1 |
| Which one of the following describes characteristics of
"protected" inheritance?
a) The base class has access only to the public or protected
members of the derived class.
b) The derived class has non-public, inheritable, access to
all but the private members of the base class.
c) The derived class has access to all members of the base
class.
d) The private members of the base class are visible within
the derived class.
e) Public members of the derived class are privately
accessible from the base class.
| Quark | 3 |
| How do you know that your class needs a virtual destructor? | Lucent | 3 |
| What is virtual constructor paradigm? | HP | 3 |
| What is a constructor initializer list and when we use
constructor initializer list?
| TCS | 2 |
| Given a simple program designed to take inputs of integers
from 1-1000 and to output the factorial value of that
number, how would you test this program? You do not have
access to the code. Please be as specific as possible.
| Microsoft | 2 |
| Write any small program that will compile in "C" but not in
"C++"? | | 3 |
| Evaluate:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);
a) 10
b) 11
c) 1
| Quark | 1 |
| Why do C++ compilers need name mangling? | Lucent | 1 |
| What is the difference between "calloc" and "malloc"? | ADP | 5 |
| implement stack using stack.h headerfile functions | Subex | 1 |
| why we cant create array of refrences | | 2 |
| What are the differences between public, private, and
protected access? | Wipro | 4 |
| Shall we use 'free' to free memory assigned by new, What are
the further consequences?? | Symphony | 4 |
| Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B"; | CTS | 3 |
| class professor {};
class teacher : public virtual professor {};
class researcher : public virtual professor {};
class myprofessor : public teacher, public researcher {};
Referring to the sample code above, if an object of class
"myprofessor" were created, how many instances of professor
will it contain?
a) 0
b) 1
c) 2
d) 3
e) 4
| Quark | 1 |
| Can we use resume in error handling i.e. in the catch block | Infosys | 3 |
| Describe functional overloading? | HP | 3 |
| |
| For more C++ General Interview Questions Click Here |