Django Features and Libraries | Week 1

Course Name: Django for Everybody

Sub-course: Django Features and Libraries

Course Link: Django for Everybody

Sub-course Link: Django Features and Libraries

These are Django Features and Libraries Week 1 Answers Coursera Quiz


Cookies and Sessions

Q1. What part of a Django application handles session management?

  • Views
  • Middleware
  • Models
  • Templates

Answer: Middleware


Q2. Where are cookies stored?

  • In elasticache
  • In the database
  • In the Python code
  • In the browser

Answer: In the browser


These are Django Features and Libraries Week 1 Answers Coursera Quiz


Q3. Which protocol determines how cookies are sent back and forth?

  • SQL
  • HTML
  • HTTP
  • CSS
  • ORM

Answer: HTTP


Q4. Which of the following Python structures is most like cookie storage?

  • dictionary
  • Template
  • list
  • database connection
  • set

Answer: dictionary


These are Django Features and Libraries Week 1 Answers Coursera Quiz


Q5. Any server can read any cookie from any other server.

  • True
  • False

Answer: False


Q6. What kind of cookies are deleted when the browser is closed?

  • Inverse cookies
  • Encrypted cookies
  • Bitcoin cookies
  • Session cookies

Answer: Session cookies


These are Django Features and Libraries Week 1 Answers Coursera Quiz


Q7. What is the method you call in a Django view to set a cookie?

  • request.setCookie()
  • response.set_cookie()
  • response.cookie.set()
  • $_COOKIES[]

Answer: response.set_cookie()


Q8. How many times do you need to set a cookie for it to persist across a number of incoming requests?

  • On every non-anonymous request
  • On every request
  • On every response to a POST request
  • Once

Answer: Once


Q9. What is the typical approach to making a session identifier?

  • Choose a large random number
  • Compute an MD5 hash of the user’s email address
  • Start at 1 and add 1 for each new session (like a primary key)
  • Use the logged-in user’s email address
See also  Web Application Technologies and Django | Week 1

Answer: Choose a large random number


These are Django Features and Libraries Week 1 Answers Coursera Quiz


Q10. Where is session data typically stored in a Django application?

  • In the browser
  • On the end user’s hard drive
  • In the server
  • In JavaScript variables

Answer: In the server


Q11. How do you set a key of ‘abc’ to the value ‘test’ in the session in a Django application?

  • $_SESSION[‘abc’] = ‘test’;
  • request.session.get(‘abc’, ‘test’);
  • request.session[‘abc’, ‘test’];
  • request.session[‘abc’] = ‘test’;

Answer: request.session[‘abc’] = ‘test’;


These are Django Features and Libraries Week 1 Answers Coursera Quiz


More Weeks of this course: Click Here

More Coursera Courses: http://progiez.com/coursera


These are Django Features and Libraries Week 1 Answers Coursera Quiz