QuizLander
← Tous les quiz publics

Python — Decorators, closures & async (advanced)

par Jude · 23/05/2026 · 6 vues · 0 partages

Higher-order functions, decorators with/without args, closures, async/await, concurrency models. 20 questions.
20
Questions
🇬🇧 English
Langue
🔴 Difficile
Difficulté
Démarrer le quiz (invité ou compte)
Partager comme image

Aperçu des questions

  1. 1. What does a decorator do?
  2. 2. Why use functools.wraps?
  3. 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. 4. Which decorator caches results of a pure function?
  5. 5. What does this print?
    import asyncio
    
    async def main():
        return 42
    
    print(type(main()))

… et 15 autres questions.

Commentaires

Connecte-toi pour commenter.

Chargement…