Top 200+ Advanced C++ Interview Questions 2020-2021 - 1

Question: 1

Differentiate between a template class and class template?

Template class: A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.

Class template: A class template specifies 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.

Question: 2

What do you mean by inline function?

The idea behind inline functions is to insert the code of a called function at the point where the function is called.

If done carefully, this can improve the application’s performance in exchange for increased compile time and possibly an increase in the size of the generated binary executables.

Question: 3

What is the difference between method overloading and method overriding?

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 rewriting the virtual method of the base class.

Question: 4

What are the advantages of inheritance?

It permits code reusability

Reusability saves time in program development

It encourages the reuse of proven and debugged high quality software, thus reducing problem after a system becomes functional.

Question: 5

What is difference between class and structure?

Structure: Initially (in C) a structure was used to bundle different types together to perform a particular functionality.

But C++ extended the structure to contain functions also.

The major difference is that all declarations inside a structure are by default public.

Class: class is a successor of Structures. By default all the members inside the class are private.

Related Questions