Analyst Integration Question:

Download Job Interview Questions and Answers PDF

Can you please explain the difference between iteration and recursion?

Integration Programmer Interview Question
Integration Programmer Interview Question

Answer:

Iteration uses loop to perform same step again and again while recursion calls function itself to do the repetitive task. Many times recursion result in a clear and concise solution of complex problem e.g. tower of Hanoi, reversing a linked list or reversing a String itself. One drawback of recursion is depth, since recursion stores intermediate result in stack you can only go upto certain depth, after that your program will die with StackOverFlowError, this is why iteration is preferred over recursion in production code.

Download Integration Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
Describe three different kinds of testing that might be performed on an application before it goes live?How to get the last digit of an integer?