Interview quiz track

First 2 free Intermediate Python

Python – Decorators

Practice Python decorator interview questions covering function wrapping, common use cases, and syntax. Write short decorator examples and receive feedback on correctness and understanding. Ideal for intermediate Python interview prep. First 2 questions are free with full feedback.

  • Level Intermediate
  • Questions 12
  • decorators

Try any track free — first 2 questions include full AI feedback. Subscribe to finish the track and unlock everything. Type or speak your answer — the first 2 questions include scoring and detailed AI feedback.

Try first 2 questions free All tracks

Sample python – decorators interview questions

Preview 6 questions from this track in quiz order. In the full quiz you answer one at a time — type or speak — then get a score and feedback.

  1. What is a decorator in Python?

    What a strong answer includes

    Function that modifies another function.

  2. How do you apply a decorator?

    What a strong answer includes

    Uses @decorator syntax.

  3. Write a simple decorator that prints before and after a function runs.

    What a strong answer includes

    Correct wrapper and return.

  4. Why do decorators use nested functions?

    What a strong answer includes

    To wrap and return a new function.

  5. What is functools.wraps used for?

    What a strong answer includes

    Preserves the original function’s metadata.

  6. Write a decorator that logs the arguments of a function.

    What a strong answer includes

    Accesses *args and **kwargs.