| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to write Multithreaded applications using C++? | Honeywell | 2 |
| Write a String class which has:
1) default constructor
2) copy constructor
3) destructor
4) equality operator similar to strcmp
5) constructor which takes a character array parameter
6) stream << operator | Lehman-Brothers | 1 |
| Difference between Operator overloading and Functional
overloading? | HP | 3 |
| write program for palindrome | | 3 |
| class Foo {
const int x;
protected:
Foo(int f);
~Foo();
};
Foo f;
Referring to the sample code above, why will the class
declaration not compile?
a) The variable x is const.
b) The destructor is protected.
c) The destructor is not public.
d) The constructor is protected.
e) There is no default constructor.
| Quark | 4 |
| this is to swap to strings....but in output the whole
strings are swapped leaving first as it is...why it is so
#include<iostream.h>
int main()
{
char a[]="ajeet";
char b[]="singh";
long x=*a;
long y=*b;
cout<<x<<":"<<y;
x=x+y;
y=x-y;
x=x-y;
*a=x;
*b=y;
cout<<x<<":"<<y;
cout<<&a<<endl;
cout<<&b<<endl;
} | | 1 |
| wrong statement about c++
a)code removably
b)encapsulation of data and code
c)program easy maintenance
d)program runs faster | | 8 |
| what is pulse code modulation?
| Wipro | 1 |
| How can you quickly find the number of elements stored in a
a) static array b) dynamic array ? | Lucent | 3 |
| How do you know that your class needs a virtual destructor? | Lucent | 3 |
| const char *
char * const
What is the differnce between the above two? | TCS | 8 |
| What is a "RTTI"? | HCL | 5 |
| What is "map" in STL? | | 1 |
| What are the different types of polymorphism? | | 2 |
| What is the output of printf("%d")? | HCL | 25 |
| What will happen if I allocate memory using "new" and free
it using "free" or allocate sing "calloc" and free it using
"delete"? | | 2 |
| What is the difference between operator new and the new
operator? | Wipro | 1 |
| What is object slicing and how can we prevent it? | Tech-Mahindra | 2 |
| Why preincrement operator is faster than postincrement? | | 3 |
| What are the types of STL containers? | | 1 |
| |
| For more C++ General Interview Questions Click Here |