Ans. stack is cleaned by the callee
Q2. mutable key word is used for
Ans. if used with a member variable it can be changes by a function declared as a constant
Q3. foo & const ref
Ans. this is not a good practise since references are always constants
Q4. private inheritance means
Ans Non private members of a base class become private members of derived class
Q5. int I=2;
Int j=3;
Int k=4;
Cout<<(I < j < k)
Ans. 1
Q6 #defines macro(a) ((a++) + (++a) + (a++))
Main()
{
cout << macro(1);
}
Ans. 4
Q7 string s = abcd
Char &c=s[1];
String t;
T=s;
c=z;
if(T[1]==z)
{
cout<
else
{
cout<
Ans. express
Q8. int func(int I)
{
static int k=0;
k++;
if( K>5)
return 1;
else
return func(I-1);
}
int main()
{
cout << func(1);
}
Ans. 1
Q9. class base
{
public:
virtual func()
{
cout <
};
class der1: public base
{
public:
virtual func()
{
cout << DER1;
}
};
class der2: public base
{
public:
virtual func()
{
cout << DER2;
}
};
class der3: public base
{
public:
virtual func1()
{
cout << DER3;
}
};
main()
{
base *pb;
pb= new der1;
pb->func();
pb= new der2;
pb->func();
pb= new der3;
pb->func();
}
Ans: DER1DER2BASE
Q10 Which of following will cause application crashthere are three options
ANS. char * p = new char;
Char *q=p;
Delete p;
Delete q;
Q11 for typeid to give correct result which condition is must
Ans. Class should be polymorphic
Q12 following things are default when class is created
Ans. Default constructor, copy constructor, assignment operator
Q13. which casting is done at run time
Ans. dynamic_cast
No comments:
Post a Comment