WorksheetsPage 1
Total questions: 16
Worksheet time: 8mins
What is the main purpose of error handling in Flask?
To design web pages
To handle database connections
To avoid application crash and show user-friendly messages
To improve UI design
Which Python construct is commonly used for error handling in Flask?
if-else
for loop
try-except
while loop
The try-except block is mainly used to handle which type of errors?
Syntax errors
Runtime errors
Logical errors
Compile-time errors
Which statement is used to create a Flask application instance?
Flask.app()
app = Flask()
app = Flask(__name__)
Flask = app()
Which decorator is used to define routes in Flask?
@route()
@app.route()
@flask.route()
@url.route()
Where are HTML files stored in a Flask project by default?
static folder
assets folder
templates folder
views folder
Which HTTP method sends data through the URL?
POST
PUT
GET
DELETE
Which HTTP method is used to receives data?
GET
POST
FETCH
CONNECT
Which HTTP method is mainly used to display web pages?
POST
GET
PATCH
OPTIONS
In Flask, form data sent using POST is accessed using:
request.args
request.url
request.form
request.data
Which file is used to start a basic Flask application?
index.html
app.py
Which function is used to render HTML templates in Flask?
show_template()
load_template()
render_template()
display_template()
Which object is used to handle incoming requests in Flask?
response
session
request
redirect
Which function is used to redirect a user to another page in Flask?
move()
redirect()
jump()
go_to()
Which statement is used to import Flask in a Python file?
import flask
from flask import Flask
include flask
require flask
Which file extension is used for Flask template files?
.py
.html
.css
.js
