| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| wrong statement about c++
a)code removably
b)encapsulation of data and code
c)program easy maintenance
d)program runs faster | | 8 |
| What are the differences between a struct in C and in C++? | Wipro | 4 |
| What are the different types of Storage classes? | | 3 |
| if i want cin 12345678910 and cout abcdefghij.
so how can i create the program?.
example : if i key in 8910 so the answer is ghij. | | 3 |
| Explain the need for "Virtual Destructor"? | Infosys | 1 |
| What is the difference between a copy constructor and an
overloaded assignment operator? | Microsoft | 3 |
| What are the basics of classifying different storage types,
why? | Symphony | 2 |
| what is meaning of isa and hsa | | 1 |
| Describe functional overloading? | HP | 3 |
| What is the difference between Class and Structure? | HP | 2 |
| What happens if an exception is throws from an object's
constructor and from object's destructor? | TCS | 2 |
| why the size of an empty class is 1 | | 3 |
|
1. What does the following do:
void afunction(int *x)
{
x=new int;
*x=12;
}
int main()
{
int v=10;
afunction(&v);
cout<<v;
}
a) Outputs 12
b) Outputs 10
c) Outputs the address of v
| Quark | 3 |
| 1)#include <iostream.h>
int main()
{
int *a, *savea, i;
savea = a = (int *) malloc(4 * sizeof(int));
for (i=0; i<4; i++) *a++ = 10 * i;
for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea += sizeof(int);
}
return 0;
}
2)#include <iostream.h>
int main()
{
int *a, *savea, i;
savea = a = (int *) malloc(4 * sizeof(int));
for (i=0; i<4; i++) *a++ = 10 * i;
for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea ++;
}
return 0;
}
The output of this two programs will be different why?
| | 2 |
| implement stack using stack.h headerfile functions | Subex | 1 |
| Explain "passing by value", "passing by pointer" and
"passing by reference" ? | | 5 |
| what is data Abstraction? and give example | TCS | 13 |
| 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 |
| Can we use resume in error handling i.e. in the catch block | Infosys | 3 |
| Why is it difficult to store linked list in an array? | Lucent | 2 |
| |
| For more C++ General Interview Questions Click Here |