| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to write Multithreaded applications using C++? | Honeywell | 2 |
| What happens if an exception is throws from an, object's
constructor and object's destructor? | Wipro | 1 |
| What is the difference between Pointer and a Reference?
When you would use them? | Wipro | 2 |
| How do I open binary files? | | 1 |
| What are advantages and disadvantages of Design patterns? | IBM | 3 |
| Explain "passing by value", "passing by pointer" and
"passing by reference" ? | | 5 |
| What are the differences between a struct in C and in C++? | Wipro | 4 |
| What are inline functions? | Verizon | 2 |
| 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 |
| Difference between shift left and shift right? | Symphony | 1 |
| What is a constructor initializer list and when we use
constructor initializer list?
| TCS | 2 |
| string somestring ;
Which of the following choices will convert a standard C++
string object "somestring" to a C string?
a) Copy.somestring () ;
b) somestring.c_str ()
c) &somestring [1]
d) std::cstring (somestring)
e) (char *) somestring
| Quark | 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 a "RTTI"? | HCL | 5 |
| What is Pure Virtual Function? Why and when it is used ? | Lucent | 4 |
| what is meaning of isa and hsa | | 1 |
| What compiler was used?
| Intel | 3 |
| class Foo {
public:
Foo(int i) { }
};
class Bar : virtual Foo {
public:
Bar() { }
};
Bar b;
Referring to the above code, when the object 'b' is defined,
a compiler error will occur. What action fixes the compiler
error?
a) Adding a virtual destructor to the class Bar
b) Adding a constructor to Bar which takes an int parameter
c) Adding "Foo()" to the Bar constructor
d) Adding a copy constructor to the class Foo
e) Adding "Foo(0)" to the Bar::Bar initializer list
| Quark | 1 |
| tell me about yourself ?i want answer for frehers with
various exasmples? | HCL | 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 |
| |
| For more C++ General Interview Questions Click Here |