1. Home
  2. Data Science
  3. Python
  4. What is the output of the following Python code snippet?

Added 25 Nov 2026

What is the output of the following Python code snippet?

from functools import lru_cache @lru_cache(None) def fib(n): return n if n
  1. Error
  2. None
  3. 55 Correct answer
  4. 89

Correct answer

C. 55

5 views

MCQSEXAM

Explanation

lru_cache memoizes recursive calls and makes Fibonacci fast.

Reference

Asked in: Python Interview Advanced

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs