Bird
0
0

Which of the following is the correct syntax to set a secure session cookie in Django settings?

easy📝 Syntax Q3 of 15
Django - Security Best Practices
Which of the following is the correct syntax to set a secure session cookie in Django settings?
ASESSION_COOKIE_SECURE = True
BSESSION_COOKIE_SECURE == True
CSESSION_COOKIE_SECURE: True
DSESSION_COOKIE_SECURE => True
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python assignment syntax

    In Django settings, assignment uses a single equals sign (=) to assign values.
  2. Step 2: Identify correct boolean assignment

    SESSION_COOKIE_SECURE = True correctly assigns the boolean True to the setting.
  3. Final Answer:

    SESSION_COOKIE_SECURE = True -> Option A
  4. Quick Check:

    Use single = for assignment in settings [OK]
Quick Trick: Use single = for assignments in Python settings [OK]
Common Mistakes:
MISTAKES
  • Using double equals (==) which is comparison, not assignment
  • Using colon or arrow which are invalid here
  • Confusing syntax from other languages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes