Recall & Review
beginner
What is a cookie in web development?
A cookie is a small piece of data stored on the user's browser. It helps websites remember information like login status or preferences.
Click to reveal answer
beginner
How do you set a cookie in Flask?
You set a cookie by creating a response object and using its
set_cookie() method with a key and value.Click to reveal answer
beginner
How do you read a cookie value in Flask?
You read a cookie from the
request.cookies dictionary using the cookie's key name.Click to reveal answer
intermediate
What is the purpose of the
max_age parameter when setting a cookie?It sets how long the cookie will last in seconds before it expires and is deleted from the browser.
Click to reveal answer
intermediate
Why should you use cookies carefully in web apps?
Because cookies store data on the user's device, they can affect privacy and security. Sensitive data should not be stored in cookies.
Click to reveal answer
Which Flask object do you use to set a cookie?
✗ Incorrect
Cookies are set on the response sent back to the browser, so you use the Response object.
How do you access cookies sent by the browser in Flask?
✗ Incorrect
Cookies sent by the browser are available in the request.cookies dictionary.
What does the
max_age parameter control when setting a cookie?✗ Incorrect
max_age sets how long the cookie stays valid before expiring.Which of these is NOT a good practice when using cookies?
✗ Incorrect
Sensitive data like passwords should never be stored in cookies for security reasons.
What type of data structure is
request.cookies in Flask?✗ Incorrect
request.cookies behaves like a dictionary where cookie names are keys.Explain how to set and read cookies in a Flask web application.
Think about how the server sends cookies and how it reads them back from the browser.
You got /4 concepts.
Describe why cookie expiration is important and how to control it in Flask.
Consider what happens if cookies never expire.
You got /4 concepts.