| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| In C++ cout is:
a) object
b) class
c) something else | Lehman-Brothers | 10 |
| difference between c and c++? | Infosys | 6 |
| Can we have "Virtual Constructors"? | TCS | 5 |
| What is Virtual Inheritance? | Wipro | 2 |
| What is "map" in STL? | | 1 |
| catch(exception &e)
{
. . .
}
Referring to the sample code above, which one of the
following lines of code produces a written description of
the type of exception that "e" refers to?
a) cout << e.type();
b) cout << e.name();
c) cout << typeid(e).name();
d) cout << e.what();
e) cout << e;
| Quark | 2 |
| what is the behaviour of C and C++ compiler for the below
statements.
int *p;
p = malloc(100);
Is the behaviour same ? or different ? | | 1 |
| What is a constructor initializer list and when we use
constructor initializer list?
| TCS | 2 |
| What is Namespace? | Samsung | 1 |
| Please post the model question paper of hal? | | 1 |
| class Foo {
int x;
public:
Foo(int I);
};
If a class does not have a copy constructor explicitly
defined one will be implicitly defined for it. Referring to
the sample code above, which one of the following
declarations is the implicitly created copy constructor?
a) Foo(Foo *f);
b) Foo(Foo &f);
c) Foo(const Foo *f);
d) Foo(const Foo &f);
e) Foo(int);
| Quark | 3 |
| What are the types of STL containers? | | 1 |
| What and all can a compiler provides by default? | HP | 3 |
| Why do C++ compilers need name mangling? | Lucent | 1 |
| 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 |
| how to find the maximum of 10 numbers ? | | 2 |
| Difference between delete and delete[]? | TCS | 3 |
| What are advantages of C++ when comparing with C? | HP | 3 |
| Is there something that we can do in C and not in C++? | Patni | 5 |
| Why is it difficult to store linked list in an array? | Lucent | 2 |
| |
| For more C++ General Interview Questions Click Here |