| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to write a program such that it will delete itself after
exectution? | | 1 |
| class basex
{
int x;
public:
void setx(int y) {x=y;}
};
class derived : basex {};
What is the access level for the member function "setx" in
the class "derived" above?
a) private
b) local
c) global
d) public
e) protected
| Quark | 1 |
| How many lines of code you have written for a single program? | BoA | 1 |
| What is Namespace? | Samsung | 1 |
| What are Binay tress and B trees? Diff between them? | CTS | 3 |
| 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 |
| Give 2 examples of a code optimization? | | 1 |
| What are the different types of polymorphism? | | 2 |
| Write the program for fibonacci in c++? | | 3 |
| Write a program that read 2o numbers in and array and
output the second largest number. Can anybody help?? | | 2 |
| What is the output of printf("%d")? | HCL | 25 |
| 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 |
| What is the difference between a copy constructor and an
overloaded assignment operator? | Microsoft | 3 |
| What is the use of static functions? | Symphony | 6 |
| Can we declare destructor as static? Explain? | | 2 |
| Write a function which takes a character array as input and
reverses it in place. | Lehman-Brothers | 2 |
| how can u create a doubly linked list with out using
pointers? | | 1 |
| What is Name Decoration? | Lucent | 2 |
| 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 |
| How do I open binary files? | | 1 |
| |
| For more C++ General Interview Questions Click Here |