PYB3M19Quiz

PY-B3-M19-Quiz 1. Which HTML attribute is used to make a form field required? A) mandatory B) validate C) required D) need Correct Ans: C) required 2. What is the default method used by HTML forms when no method is specified? A) POST B) PUT C) DELETE D) GET Correct Ans: D) GET 3. In Django, which class helps create a form directly from a model? A) Form B) BaseForm C) ModelForm D) ModelFields Correct Ans: C) ModelForm 4. Which HTTP method is used to update data in a form submission? A) GET B) POST C) PUT D) DELETE Correct Ans: C) PUT 5. When handling media files in Django, which setting must be configured to serve uploaded files during development? A) STATIC_ROOT B) TEMPLATE_DIRS

PYB3M19Quiz - Page 1

C) MEDIA_URL D) FORM_MEDIA Correct Ans: C) MEDIA_URL 6. What is the purpose of {% block content %} in Django templates? A) To define variables B) To display form fields C) To create editable sections in child templates D) To render media files Correct Ans: C) To create editable sections in child templates 7. Which Django component allows you to show success/error messages after a form submission? A) Middleware B) CSRF Protection C) Message Framework D) Session Engine Correct Ans: C) Message Framework 8. What is template inheritance in Django? A) Importing templates from another project B) Using Python classes in templates C) Reusing a base template layout D) Embedding CSS in templates Correct Ans: C) Reusing a base template layout 9. In Django Class-Based Views, which class is typically used to create new objects? A) TemplateView B) UpdateView C) CreateView D) DeleteView Correct Ans: C) CreateView 10. What is the advantage of reusable templates for forms in Django?

A) Less code duplication B) Better security C) Faster database queries D) More HTTP methods Correct Ans: A) Less code duplication