C++ Interview Questions and Answers

What is function overloading?

Function overloading or Function polymorphism is the ability to write more than one function with the same name, but the number or type of the parameters is different.


What is the difference between function overloading and overriding?

Overloading of Function called when more than one method created with the same name, but with a different signature (number and type of its Parameters). While in function overriding, method created in a derived class with the same name as a method in the base class and the same signature (number and type of its Parameters).


What is operator overloading?

Operator overloading is a mechanism that help to perform Operator operation on User defined data types like they operate on built-in data types, such as addition (+) and multiplication (*).


What is virtual function?

Runtime Polymorphism or dynamic binding mechanism is supported the use of virtual functions whereas pointers of base classes can keep derived class objects. Thus,
<base class>* baseObj = new <derived class>;

When derived class override base class virtual function then the override function call depend on contents (object pointed) of base class pointer that resolved at run time.


What is pure virtual functions?

A pure virtual member function is made by initializing it with zero in the base class and those must be override in derived classes.

virtual void speak () = 0;

What do you mean by inline function?

On calling the function, execution of the program jumps to calling function instructions, and when the function returns, execution jumps back to the next line in the calling function.It is some performance overhead in jumping in and out of functions.
When a function is declared with the keyword inline, the compiler does not create a real function: it copies the code from the inline function directly into the calling function. No jump is made; it is just as written the statements of the function right into the calling function.

Latest Updates

Fill in the blank

I ________ station before the train arrived.

If I ______ a king, I would help everyone.

Radha___________her daughter for an hour.

Errors Identification

Find out which part of the sentence below has an error and mark the option accourdingly -
Sohan was married in 1990 and have three children.

Find out which part of the sentence below has an error and mark the option accourdingly -
There is no money in the bank in Ram Singh's and Rama's joint account.


Swapnil start from his home and walked 35 km towards east, after that he turned to his right and walked 20 km. He again turned to his right and walks 35 km. Finally, he turned to his left and walked 20 km and reached his office. How far is his office from his home?


How many 2 digit numbers are divisible by 6?


Find the smallest square number which is exactly divisible by 3, 5, 15, 18, 20 and 24?

HCF and LCM of two numbers are 82 and 574 respectively. if one of the numbers is 287, find the second number?


How many numbers between 1200 to 1500 are multiple of 13?

Find the total number of terms in the series : -3, 1, 5, 9,............., 101 ?

Find the sum of the first 20 terms of the series : 8, -3, 11, -6, 14, -12, 17, -24,....... ?


Find the missing term in the given series - 101, 120, 145, 168, (?), 224

Find the missing term in the given series - 11A13, 17E19, (?), 31O37, 41U43

Find the missing term in the given series - 2,4,8,3,9,27,4,16,(?),5,25,125


Which gas is fixed by Rhizobium bacteria present in the root nodules of a pea plant ?


The formation of sulphurous acid involves ?

The acid present in soft drinks is ?