← Quiz: Python Decorators: all 10 questions
Quiz: Python Decorators · Question 10 of 10
Which of these is a typical real use of decorators?
Which of these is a typical real use of decorators?
- A.Declaring the type of a variable
- B.Checking that a user is logged in before a page function runs
- C.Importing a module
- D.Defining a loop
Answer & explanation
Correct answer: Checking that a user is logged in before a page function runs
Web frameworks use decorators for login checks, routing and caching.
Can you get the rest right without peeking?
Take the timed Quiz: Python Decorators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →