| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Difference between Overloading and Overriding? | HP | 4 |
| Is structure can be inherited? | HP | 3 |
| what is the size of this class
class size
{
public:
char data1;
double d;
int data2;
char data3;
double data4;
short data5;
};
please explain the padding for these double variables. | | 6 |
| What does '\r' and '\b' mean? Please explain with example.
| | 2 |
| difference between c and c++? | Infosys | 7 |
| Can we have "Virtual Constructors"? | TCS | 5 |
| What are the differences between a struct and a class in
C++? | Wipro | 4 |
| Write the program form Armstrong no in c++? | | 4 |
| How to change constant values? | Symphony | 3 |
| How many bit combinations are there in a byte? | Intel | 7 |
| 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 |
| class X
{
private:
int a;
protected:
X(){cout<<"X constructor was called"<<endl;}
~X(){cout<<"X destructor was called"<<endl}
};
Referring to the code above, which one of the following
statements regarding "X" is TRUE?
a) X is an abstract class.
b) Only subclasses of X may create X objects.
c) Instances of X cannot be created.
d) X objects can only be created using the default copy
constructor.
e) Only friends can create instances of X objects.
| Quark | 2 |
| Difference between shift left and shift right? | Symphony | 1 |
| Explain the ISA and HASA class relationships. How would you
implement each in a class design? | | 2 |
| whats the size of class EXP on 32 bit processor?
class EXP
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
}; | Huawei | 4 |
| What are the differences between a struct in C and in C++? | Wipro | 4 |
| structure contains int, char, float how it behaves for big
endian and little endian? | BITS | 1 |
| write the prime no program in c++? | | 4 |
| 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 |
| what is the order of initialization for data? | TCS | 4 |
| |
| For more C++ General Interview Questions Click Here |