ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2264)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
Question
what are the advantage and disadvantage of recursion
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
Recursion will be useful when same kind of job has to be
continued for a finite no input or time.

Eg: calculating series, finding factorial etc..

Disadvantage would be,
1.Hard to analyse or understand the code.
2.If the recursive function is called for infinite no of
times and memory constrains are not taken care, then stack
overflow may occur So system may crash.
 
Is This Answer Correct ?    29 Yes 3 No
VadivelT
 
Answer
# 2
Advantage : Perform an action untill a condition
satisfies,Also for the repetative calls for inputting and
etc.
Disadvantage: If it encounters the infinite looping then
the stack overflow occurs it will cause ssem crash...
 
Is This Answer Correct ?    13 Yes 1 No
Suman Boddukuru
 
 
 
Answer
# 3
Recursion will be useful when same kind of job has to be
continued for a finite no input or time.

Eg: calculating series, finding factorial etc..

Disadvantage would be,
1.Hard to analyse or understand the code.
2.If the recursive function is called for infinite no of
times and memory constrains are not taken care, then stack
overflow may occur So system may crash.
 
Is This Answer Correct ?    13 Yes 3 No
Satyabrata Nayak
 
Answer
# 4
Recursion
Advantage
i. Usually simplicity.
ii. Although at most of the times a problem can be solved without recursion, but in some situations in programming, it is a must to use recursion. For example, a program to display a list of all files of the system cannot be solved without recursion.
iii. The recursion is very flexible in data structure like stacks, queues, linked list and quick sort.
iv. Using recursion, the length of the program can be reduced.
Disadvantage
i. It requires extra storage space. The recursive calls and automatic variables are stored on the stack. For every recursive calls separate memory is allocated to automatic variables with the same name.
ii. Often the algorithm may require large amounts of memory if the depth of the recursion is very large. If the programmer forgets to specify the exit condition in the recursive function, the program will execute out of memory.
iii. The recursion function is not efficient in execution speed and time.
iv. Some function calls inside recursion are repeated or duplicated just like fibonacci
 
Is This Answer Correct ?    3 Yes 0 No
Vasu Jain
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output? Ramco 7
how can i get this by using for loop? * ** * **** * ****** Excel 3
What does a run-time "null pointer assignment" error mean?   2
writw a program to insert an element in the begning of a doubly linked list   1
what is a static function Satyam 10
Given a single Linked list with lakhs of nodes and length unknown how do you optimally delete the nth element from the list? Oracle 1
write a program that accepts 3 numbers from the user. dispaly the values in a descending order.   2
matrix multiplication fails introspect the causes for its failure and write down the possible reasons for its failurein c language. TCS 4
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?   1
main() { float a=3.2e40; printf("%d",a); } Satyam 9
write a program to find the largest and second largest integer from an array Value-Labs 2
what is the difference between declaration ,defenetion and initialization of a variable? LG-Soft 7
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com