NANDHOO
.
Learning Paths
Dashboard
Sign In
Home
Dashboard
Flask Framework Engineering
Forms & Validation
Quiz
Chapter Quiz: Forms & Validation
Mastery Assessment: Forms & Validation
Complete this assessment with 100% score to master this chapter.
01
What is the purpose of `{{ form.hidden_tag() }}` in a Flask-WTF form template?
To hide the submit button.
To render the hidden CSRF token required to validate the form submission securely.
To encrypt the form data.
To automatically style the form.
02
In WTForms, what is the difference between `form.data` and `form.populate_obj(obj)`?
They are identical.
form.data is a dictionary of validated values, while populate_obj(obj) automatically maps those values onto the attributes of a Python object (like a DB model).
populate_obj(obj) is used for rendering HTML.
form.data is only available before validation.
03
Why is `werkzeug.utils.secure_filename` mandatory when handling file uploads?
It makes the file smaller.
It converts the file to a safer format like PDF.
It sanitizes the filename to prevent directory traversal attacks (e.g., an attacker uploading a file named '../../etc/passwd').
It is required by the HTTP standard.
Submit Answers
Back to Lesson
Next Chapter