C++ is an enhanced version of the C language. C++ includes everything that is part of C and adds support for object- oriented programming (OOP). In addition, C++ also contains many improvements and features that make it a "better C", independent of object oriented programming. C++ is actually an extendible language since we can define new types in such a way that they act just like the predefined types which are part of the standard language.
If you just use C++ as a better C, you will not be using all of its power. Like any quality tool, C++ must be used the way it was designed to be used to exploit its richness. Some of the new features include encapsulation, inline function calls, overloading operators, inheritance and polymorphism. I am not going to explain what they mean here as that would simply take me away from my purpose here, but you can refer to any good C++ book or the C++ FAQ for more information.
C++ Language Interviews are getting tough these days as the technology grows faster. To get through the C++ Language interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed C++ Language questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on C++ Language and various other technologies interview preparation.
11. How do you know that your class needs a virtual destructor?
If your class has at least one virtual function, you should make a destructor for this class virtual. This will allow you to delete a dynamic object through a baller to a base class object. If the destructor is non-virtual, then wrong destructor will be invoked during deletion of the dynamic object.
12. How do you link a C++ program to C functions?
By using the extern "C" linkage specification around the C function declarations. Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern "C" linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions.
13. how individual classes can be constructed much like the way a class
specifies how individual objects can be constructed. It?s jargon for plain classes.
14. How many ways are there to initialize an int with a constant?
1. int foo = 123; 2. int bar(123);
15. How the compilers arranges the various sections in the executable image?
The executable had following sections:- Data Section (uninitialized data variable section, initialized data variable section ) Code Section Remember that all static variables are allocated in the initialized variable section.
16. How Virtual functions call up is maintained?
Through Look up tables added by the compile to every class image. This also leads to performance penalty.
17. Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible ?
There is nothing like Virtual Constructor. The Constructor cant be virtual as the constructor is a code which is responsible for creating a instance of a class and it cant be delegated to any other object by virtual keyword means.
18. Is there any problem with the following:
char *a=NULL; char& p = *a;? The result is undefined. You should never do this. A reference must always refer to some object.
19. List out some of the object-oriented methodologies.
Object Oriented Development (OOD) (Booch 1991,1994), Object Oriented Analysis and Design (OOA/D) (Coad and Yourdon 1991), Object Modelling Techniques (OMT) (Rumbaugh 1991), Object Oriented Software Engineering (Objectory) (Jacobson 1992), Object Oriented Analysis (OOA) (Shlaer and Mellor 1992), The Fusion Method (Coleman 1991).
20. List out some of the OODBMS available.
GEMSTONE/OPALof Gemstone systems, ONTOS of Ontos, Objectivity of Objectivity Inc, Versant of Versant object technology, Object store of Object Design, ARDENT of ARDENT software, POET of POET software.