Skip to main content

Posts

Showing posts with the label c frequently asked interview questions

C Programming Interview Questions With Answers - Part IX.

60. What Is Recursion? Answer: Recursion is the process of repeating items in a self-similar way. Same applies in programming languages as well where if a programming allows you to call a function inside the same function that is called recursive call of the function as follows: void recursion() { recursion(); /* function calls itself */ } int main() { recursion(); } The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go in infinite loop. Recursive function is very useful to solve many mathematical problems like to calculate factorial of a number, generating Fibonacci series, etc. 61. A Recursive Procedure Should Have Two Properties. What Are They? Answer: There are two important conditions that must be satisfied by any recursive procedure. They are: There must be some base case where the condition end. Ea...