ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
import sys print(sys.getrecursionlimit())
- A. 1000
- B. 3000
- C. 100
- D. 10000
Correct answer: A. 1000
CPython's default recursion limit for Python frames is 1000. sys.setrecursionlimit raises it, but going very high can still crash the C stack, which is why iterative code is safer on judges.
More Python Programming questions
- What is printed? python import sys sys.setrecursionlimit(50) def f(n): return 0 if n == 0 else 1 + f(n - 1) try: print(f(60)) except…
- What is printed? python from functools import lrucache @lrucache(None) def f(n): return n if n < 2 else f(n - 1) + f(n - 2) print(f(90))
- What is printed? python from functools import lrucache import sys sys.setrecursionlimit(1000) @lrucache(None) def f(n): return 0 if n == 0…
- What is printed? python g = {1: [2, 3], 2: [4], 3: [], 4: []} stack = [1] out = [] while stack: u = stack.pop() out.append(u)…
- What is printed? python s = list(range(10)) print(s[8:2:-3], s[::-4], s[-3:])
- What is printed? python a = [1, 2, 3, 4, 5] a[1:3] = [9] 4 print(a)