| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Write a program that read 2o numbers in and array and
output the second largest number. Can anybody help?? | | 2 |
| Write any small program that will compile in "C" but not
in "C++" | Honeywell | 6 |
| What will happen if I allocate memory using "new" and free
it using "free" or allocate sing "calloc" and free it using
"delete"? | | 2 |
| 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 |
| structure contains int, char, float how it behaves for big
endian and little endian? | BITS | 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 |
| int f() {
int I = 12;
int &r = I;
r += r / 4;
int *p = &r;
*p += r;
return I;
}
Referring to the sample code above, what is the return value
of the function "f()"?
a) 12
b) 15
c) 24
d) 17
e) 30
| Quark | 2 |
| is throwing exception from a constructor not a good practice ? | Ericsson | 4 |
| Explain about profiling? | | 1 |
| How many bit combinations are there in a byte? | Intel | 7 |
| 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 |
| Which uses less memory?
a)
struct astruct
{
int x;
float y;
int v;
};
b)
union aunion
{
int x;
float v;
};
c)
char array[10];
| Quark | 3 |
| What happens if an exception is throws from an, object's
constructor and object's destructor? | Wipro | 1 |
| What are the total number of lines written by you in C/C++?
What is the most complicated or valuable program written in
C/C++?
| Intel | 1 |
| What is the difference between "calloc" and "malloc"? | ADP | 5 |
| Given a simple program designed to take inputs of integers
from 1-1000 and to output the factorial value of that
number, how would you test this program? You do not have
access to the code. Please be as specific as possible.
| Microsoft | 2 |
| What are Virtual Functions? How to implement virtual
functions in "C" ? | | 2 |
| Which of the Standard C++ casts can be used to perform a
?safe? downcast:
a) reinterpret_cast
b) dynamic_cast
c) static_cast
d) const_cast
| Quark | 1 |
| What are the types of STL containers? | | 1 |
| how to find the maximum of 10 numbers ? | | 3 |
| |
| For more C++ General Interview Questions Click Here |