You want to build a simple web app with a few pages and minimal database use. Which framework is better suited for quick setup and flexibility?
Think about which framework is minimal and flexible for small apps.
Flask is lightweight and flexible, ideal for small projects where you want to add only needed features. Django is more heavyweight with many built-in parts, better for larger projects.
Which statement correctly describes how Django and Flask handle database schema changes?
Consider which framework includes built-in tools for database migrations.
Django includes built-in migration tools that track model changes and apply them to the database. Flask requires external libraries like Alembic for migrations.
Which Flask route definition will correctly respond to GET requests at URL '/hello'?
from flask import Flask app = Flask(__name__) @??? def hello(): return "Hello!"
Check the correct keyword and value type for specifying HTTP methods in Flask routes.
The 'methods' parameter expects a list of HTTP methods. Option D uses the correct syntax with a list ['GET'].
Given this Django template snippet and context, what will be the rendered output?
{% if user.is_authenticated %}
Welcome, {{ user.username }}!
{% else %}
Please log in.
{% endif %}Assume the context has user.is_authenticated = True and user.username = 'alice'.
The template checks if the user is authenticated. Since true, it renders the welcome message with the username.
What error will this Flask code raise when trying to access request.args outside a request context?
from flask import Flask, request app = Flask(__name__) print(request.args)
Think about when Flask's request object is available.
The request object is only available during an active HTTP request. Accessing it outside raises a RuntimeError.