← Tous les quiz publics
Démarrer le quiz (invité ou compte)
Python — Decorators, closures & async (advanced)
par Jude · 23/05/2026 · 6 vues · partages
Higher-order functions, decorators with/without args, closures, async/await, concurrency models. 20 questions.
20
Questions
🇬🇧 English
Langue
🔴 Difficile
Difficulté
Aperçu des questions
-
1. What does a decorator do?
-
2. Why use
functools.wraps? -
3. What is printed?
def make_counter(): n = 0 def inc(): nonlocal n n += 1 return n return inc c = make_counter() print(c(), c(), c()) -
4. Which decorator caches results of a pure function?
-
5. What does this print?
import asyncio async def main(): return 42 print(type(main()))
… et 15 autres questions.