C++ Language INTERVIEW QUESTION & ANSWERS
81. |
What is recursive function? |
|
A function which calls itself directly or indirectly again and again is known as the recursive function. Recursive functions are very useful while constructing the data structures like linked lists, double linked lists and trees. There is a distinct difference between normal and recursive functions. |
82. |
What is the difference between goto and unconditional goto? |
|
The goto statement is used to alter the program execution sequence by transferring the control to some other part of the program.
The unconditional goto statement is used just to transfer the control from one part of the program to the other part without checking any condition. Normally, a good programmer will not prefer to use the unconditional goto statement in his program as it may lead to a very complicated problem like a never ending process. |
83. |
What is the difference between class and structure? |
|
- By default, the members ot structures are public while that tor class is private.
- Structures doesn't provide something like data hiding which is provided by the classes.
- Structures contains only data while class bind both data and member functions.
|
84. |
What are design patterns? |
|
Design patterns are reusable, extensible solutions to common design problems faced by designers of object-oriented systems. Design patterns are language neutral and are of a higher level of abstraction than code. |
85. |
What is the difference between the terms overloading and overriding? |
|
The term overriding refers to providing an alternative function definition of a virtual function in a derived class. Overriding is useful for runtime polymorphism. With overloading, more than one method definition with the same name (but with different types/number of arguments) are provided, whereas in overriding, the methods with the same name are provided with alternative definition in derived class. |