| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to implement flags? | Symphony | 1 |
| How is an Abstract Base Class(ABC) related to an "Abstract
Data Type" (ADT) | | 2 |
| Is there something that we can do in C and not in C++? | Patni | 5 |
| Have you used MSVC? What do you think of it? | Google | 2 |
| In C++ cout is:
a) object
b) class
c) something else | Lehman-Brothers | 10 |
| How can you find the nodes with repetetive data in a linked
list? | Lucent | 1 |
| When volatile can be used? | Symphony | 2 |
| What is Object Oriented programming.what is the difference
between C++ and C? | Infosys | 5 |
| What is "mutable" keyword? | | 2 |
|
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 |
| What is the difference between a copy constructor and an
overloaded assignment operator? | Microsoft | 3 |
| How do you know that your class needs a virtual destructor? | Lucent | 3 |
| How to avoid changing constant values? | Symphony | 1 |
| What is the Difference between "vector" and "array"? | TCS | 6 |
| What is the output of:
String a1 = "Hello";
String a2 = "world!";
String* s1 = &a2;
String& s2 = a1;
s1 = &a1;
s2 = a2;
std::cout << *s1 << " " << s2 << std::endl; | Lehman-Brothers | 4 |
| Evaluate:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);
a) 10
b) 11
c) 1
| Quark | 1 |
| Write a program to reverse a linked list? | Catalytic-Software | 2 |
| whats the size of class EXP on 32 bit processor?
class EXP
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
}; | Huawei | 4 |
| 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 |
| What is the difference between operator new and the new
operator? | Wipro | 1 |
| |
| For more C++ General Interview Questions Click Here |