PythonTutorials.net
Toggle Menu
Home
Online Python Compiler
Tutorials
Django
Flask
Scikit-Learn
NumPy
NLTK
Pillow
Blog
All Posts
Flask Web Development
Assess your grasp of Flask’s routing,request handling,and Jinja2 templating.
1. What is the minimal code required to create a basic Flask application?
from flask import App; app = App()
from flask import Flask; app = Flask(__name__)
import flask; app = flask.create_app()
flask init-app --name myapp
2. Which HTTP methods can be explicitly specified in a Flask route using the 'methods' parameter?
GET
POST
PUT
DELETE
3. Flask is classified as a 'micro' web framework because it includes built-in database support.
True
False
4. What function is used to redirect a user to another route in Flask?
5. Which folder is the default location for Jinja2 templates in a Flask application?
templates
views
html
static
6. Which of the following are valid ways to pass data to a Flask template?
Keyword arguments in render_template()
The 'g' object
Session variables
Global Python variables
7. Jinja2 is the default templating engine used by Flask.
True
False
8. What is the function used to render an HTML template in Flask?
render_template
render_html
template_render
html_render
9. What is the common abbreviation for Flask's built-in development server command (run via CLI)?
10. Which decorator is used to define a route in Flask?
@app.route
@route.app
@flask.route
@define.route
11. Which of the following are valid Flask configuration methods?
Setting values in app.config dictionary
Using a .env file with python-dotenv
Loading from a separate config.py file
Using the 'flask config set' CLI command
12. Blueprints in Flask are used to split large applications into smaller, reusable components.
True
False
13. What is the default port number for the Flask development server?
5000
8080
80
3000
14. Name the Flask extension that simplifies user authentication (common name).
15. Which object is used to access form data sent via a POST request in Flask?
request.form
request.post
request.data
request.params
16. Which of the following are valid Jinja2 template inheritance blocks?
{% block content %}
{% block title %}
{% block head %}
{% block body %}
17. The 'secret_key' configuration is optional for using sessions in Flask.
True
False
18. What decorator is used to handle 404 Not Found errors in Flask?
@app.errorhandler(404)
@app.notfound
@app.handle_404
@app.error_404
19. Which of the following are Flask extensions for database integration?
Flask-SQLAlchemy
Flask-Migrate
Flask-WTF
Flask-RESTful
20. What is the file extension for Jinja2 template files?
Reset
Answered 0 of 0 — 0 correct