wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Page 1

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

What is the main purpose of error handling in Flask?

a)

To design web pages

b)

To handle database connections

c)

To avoid application crash and show user-friendly messages

d)

To improve UI design

2.

Which Python construct is commonly used for error handling in Flask?

a)

if-else

b)

for loop

c)

try-except

d)

while loop

3.

The try-except block is mainly used to handle which type of errors?

a)

Syntax errors

b)

Runtime errors

c)

Logical errors

d)

Compile-time errors

4.

Which statement is used to create a Flask application instance?

a)

Flask.app()

b)

app = Flask()

c)

app = Flask(__name__)

d)

Flask = app()

5.

Which decorator is used to define routes in Flask?

a)

@route()

b)

@app.route()

c)

@flask.route()

d)

@url.route()

6.

Where are HTML files stored in a Flask project by default?

a)

static folder

b)

assets folder

c)

templates folder

d)

views folder

7.

Which HTTP method sends data through the URL?

a)

POST

b)

PUT

c)

GET

d)

DELETE

8.

Which HTTP method is used to receives data?

a)

GET

b)

POST

c)

FETCH

d)

CONNECT

9.

Which HTTP method is mainly used to display web pages?

a)

POST

b)

GET

c)

PATCH

d)

OPTIONS

10.

In Flask, form data sent using POST is accessed using:

a)

request.args

b)

request.url

c)

request.form

d)

request.data

11.

Which file is used to start a basic Flask application?

a)

index.html

b)

app.py

12.

Which function is used to render HTML templates in Flask?

a)

show_template()

b)

load_template()

c)

render_template()

d)

display_template()

13.

Which object is used to handle incoming requests in Flask?

a)

response

b)

session

c)

request

d)

redirect

14.

Which function is used to redirect a user to another page in Flask?

a)

move()

b)

redirect()

c)

jump()

d)

go_to()

15.

Which statement is used to import Flask in a Python file?

a)

import flask

b)

from flask import Flask

c)

include flask

d)

require flask

16.

Which file extension is used for Flask template files?

a)

.py

b)

.html

c)

.css

d)

.js