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

Indian Geography

What is the approximate distance between earth and the moon?

Indian History

In which year was the battle of ‘Koregaon Bhima’ fought?

The approach that is very useful in organizing the content in history is.

General Knowledge of India

NITI Aayog stands for _____.

General Knowledge of MP

India’s first Ramayan art museum was established at?

Errors Identification

Read the sentence carefully and choose the option that has an error in it:
The management’s trusted employee was suspected of stealing large sum of money.

Read the sentence carefully and choose the option that has an error in it:
The teacher asked the child to repeat again because he spoke feebly.

Fill in the blank

Fill in the blank with the most appropriate preposition in the given sentence.
Let’s sit _________ the shade of this beautiful tree.

Choose the most appropriate determiner for the given sentence.
________of what he said was very sensible.

Substitution

Choose the option that substitutes the given phrase appropriately.
A work of art made by carving

Correct sentence

Choose the option that best transforms the sentence into its Indirect form:
‘What country do you come from?’ said the police officer.

Alternative Phrase

Choose the option that best explains the highlighted expression:
All human beings have feet of clay.

Fill in the blank

Choose an appropriate modal for the given sentence:
My doctor said that I_____ stop smoking as one of my lungs got infected.

Choose the appropriate prepositions for the given sentence:
My parents have been married ________ forty-nine years, but you can still see the love ________ their eyes.

Choose the appropriate conjunction for the given sentence:
______ it rains, the college will declare the holiday.

Antonyms

Choose the appropriate antonym for the highlighted word in the given sentence.
The family protracted their visit by several days.

Tenses

Choose the appropriate tenses to fill in the blanks in the given sentence:
Please _________ a noise. Ritu __________ to sleep.

Synonyms

Choose the appropriate synonym for the highlighted word in the given sentence.
Does he really expect us to believe such a flimsy excuse?