Quiz on Recursion in Python
When we talk about recursion, it’s easy to understand as we use it in our day to day lives extensively. Without wasting much time let us start the quiz on Recursion in Python and understand more about recursion. All the best!
0 of 15 Questions completed Questions: You have already completed the quiz before. Hence you can not start it again. Quiz is loading… You must sign in or sign up to start the quiz. You must first complete the following: 0 of 15 Questions answered correctly Your time: Time has elapsed You have reached 0 of 0 point(s), (0) Earned Point(s): 0 of 0, (0) What is the set recursion depth by default and can we modify it? Recursion calls are stored on the memory in which data structure? What is the error given by the system when the recursion limit is exceeded? Which of the following is true about recursive functions? What are some of the problems with recursion? Find the output of the code given below? # Code snippet starts s = 0 def sumArray(arr,num): for i in range(len(arr)): if i == len(arr)-1: return num+arr[i] else: return sumArray(arr[i+1:],num+arr[i]) arr = [1,2,0,3,5] print(sumArray(arr,s)) # Code snippet ends Find the output of the code given below? # Code snippet starts def recurs(s): recurs(s) org = ‘QuizOrbit’ recurs(org) # Code snippet ends What is the reason behind the output of the code given below? # Code snippet starts def recurs(s): recurs(s) org = ‘QuizOrbit’ recurs(org) # Code snippet ends What is the number of lines in the output of the code given below? # Code snippet starts def matrix(n): if n==1: print(“1”) else: for i in range(1,n): print(i,end=” “) print() matrix(n-1) matrix(5) # Code snippet ends What is the content of the 2nd line from the last for the code given below? # Code snippet starts def matrix(n): if n==1: print(“1”) else: for i in range(1,n): print(i,end=” “) print() matrix(n-1) matrix(5) # Code snippet ends How many times does 5 appear in the output of the code given below? # Code snippet starts def matrix(n): if n==1: print(“1”) else: for i in range(1,n): print(i,end=” “) print() matrix(n-1) matrix(5) # Code snippet ends Find the output of the code given below? # Code snippet starts def fac(x): return (x * fac(x-1)) print(fac(5)) # Code snippet ends What correction do we need in the following code to function properly? # Code snippet starts def fac(x): return (x * fac(x-1)) print(fac(5)) # Code snippet ends Find the output of the code given below? # Code snippet starts def pprint(n): if n == 0: return else: return pprint(n-1) print(pprint(5)) # Code snippet ends Find the output of the code given below? # Code snippet starts s = 0 def sumArray(arr,num): for i in range(len(arr)): if i == len(arr)-1: else: return sumArray(arr[i+1:],num+arr[i]) arr = [1,2,0,3,5] print(sumArray(arr,s)) # Code snippet ends Quiz Summary
Information
Results
Results
0 Essay(s) Pending (Possible Point(s): 0) Categories
1. Question
2. Question
3. Question
4. Question
5. Question
6. Question
7. Question
8. Question
9. Question
10. Question
11. Question
12. Question
13. Question
14. Question
15. Question
Summary
Recursion is the most practical fundamental in any programming language. We hope with this quiz you might have gauged your understanding of recursion. Keep attempting more and more quizzes and learn on the way. Happy Learning!