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.
- Each recursive call to the procedure involve a smaller case of the problem.
62. What Is Recursive Function?
Answer: A recursive function is a function in which the statement of the function within the function body, calls the same function. Such a function is also called circular definition.
63. For Implementing Recursive Function Which Data Structure Is Used Is?
Answer: For implementing recursive function, stack is used as a data structure.
64. Which Data Structure Is Needed To Convert A Recursion To An Iterative Procedure?
Answer: The data structure needed to convert a recursion to an iterative procedure is stack
65. What Impact Would An Infinite Recursion Have On Run-Time Stack?
Answer: It would result in an overflow of run time stack.
66. Why Is The Reasoning Behind 'Recursive Procedures Are Implemented By Using Stack Data Structure'?
Answer: Recursive procedures are implemented by using stacks because stacks are LIFO data structure and we need this feature to store return addresses of various recursive calls in recursive procedures.
Check Out Other Questions:
46) How is deletion in an array list carried out?
47) What are the advantages of array lists?
48) What are the disadvantages of an array list?
49) What is a linked list in C?
50) What is a node?
51) What are the uses of pointers in C Programming?
52) What is the difference between call by value and call by reference (or Pass by value or pass by reference)?
53) What is a huge pointer?
54) What is near pointer?
55) In C, why is the void pointer useful? When would you use it?
...Return To C Questions Index.
...Return To C Programming Index.
... Return To HR Interview Index
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com