| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| this is to swap to strings....but in output the whole
strings are swapped leaving first as it is...why it is so
#include<iostream.h>
int main()
{
char a[]="ajeet";
char b[]="singh";
long x=*a;
long y=*b;
cout<<x<<":"<<y;
x=x+y;
y=x-y;
x=x-y;
*a=x;
*b=y;
cout<<x<<":"<<y;
cout<<&a<<endl;
cout<<&b<<endl;
} | | 1 |
| What are the different operators in C++? | HP | 1 |
| What is conversion constructor? | TCS | 1 |
| How do you test your code?
| Microsoft | 3 |
| 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 |
| How is an Abstract Base Class(ABC) related to an "Abstract
Data Type" (ADT) | | 2 |
| What are the different types of Storage classes? | | 3 |
| Write any small program that will compile in "C" but not
in "C++" | Honeywell | 6 |
| What C++ libraries are you proficient with? | Google | 1 |
| What is a mutex and a critical section.Whats difference
between them?How do each of them work? | CTS | 1 |
| 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 is the Difference between "C structure" and "C++
structure"? | | 3 |
| What is the difference between Class and Structure? | HP | 2 |
| What are advantages and disadvantages of Design patterns? | IBM | 2 |
| What are Binay tress and B trees? Diff between them? | CTS | 1 |
| 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 |
| Can we use resume in error handling i.e. in the catch block | Infosys | 3 |
| Is there any difference between dlearations int* x and int
*x? If so tell me the difference? | Lason | 13 |
| 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 |
| Which one of the following describes characteristics of
"protected" inheritance?
a) The base class has access only to the public or protected
members of the derived class.
b) The derived class has non-public, inheritable, access to
all but the private members of the base class.
c) The derived class has access to all members of the base
class.
d) The private members of the base class are visible within
the derived class.
e) Public members of the derived class are privately
accessible from the base class.
| Quark | 3 |
| |
| For more C++ General Interview Questions Click Here |