Category Archives: C++ Interview Questions

What are the defining traits of an object-oriented language? | C Plus Plus Questions

The defining traits of an object-oriented language are: encapsulation inheritance polymorphism

Posted in C++ Interview Questions | Leave a comment

What methods can be overridden in Java? | C Plus Plus Questions

In C++ terminology, all public methods in Java are virtual. Therefore, all Java methods can be overwritten in subclasses except those that are declared final, static, and private.

Posted in C++ Interview Questions | Leave a comment

In C++, what is the difference between method overloading and method overriding? | C Plus Plus Questions

Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class … Continue reading

Posted in C++ Interview Questions | Leave a comment

What is the Standard Template Library (STL)? | C Plus Plus Questions

A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification. A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average … Continue reading

Posted in C++ Interview Questions | Leave a comment

What is an explicit constructor? | C Plus Plus Questions

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.

Posted in C++ Interview Questions | Leave a comment

Explain the scope resolution operator. | C Plus Plus Questions

It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

Posted in C++ Interview Questions | Leave a comment

What does extern mean in a function declaration in C++? | C Plus Plus Questions

It tells the compiler that a variable or a function exists, even if the compiler hasn’t yet seen it in the file currently being compiled. This variable or function may be defined in another file or further down in the … Continue reading

Posted in C++ Interview Questions | Leave a comment

What is the best way to declare and define global variables? | C Plus Plus Questions

The best way to declare global variables is to declare them after including all the files so that it can be used in all the functions.

Posted in C++ Interview Questions | Leave a comment

What is polymorphism in C++? Explain with an example? | C Plus Plus Questions

“Poly” means “many” and “morph” means “form”. Polymorphism is the ability of an object (or reference) to assume (be replaced by) or become many different forms of object. Example: function overloading, function overriding, virtual functions. Another example can be a … Continue reading

Posted in C++ Interview Questions | Leave a comment

What do you mean by pure virtual functions? | C Plus Plus Questions

A pure virtual member function is a member function that the base class forces derived classes to provide. Normally these member functions have no implementation. Pure virtual functions are equated to zero. class Shape { public: virtual void draw() = … Continue reading

Posted in C++ Interview Questions | Leave a comment