Search Header Logo

Flask Basics - 60 MCQs

Authored by Benjamin Hotor

Computers

University

Used 2+ times

Flask Basics - 60 MCQs
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

56 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which command starts a Flask app in debug mode?

app.run()

app.run(debug=True)

flask debug

python debug app.py

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What decorator is used to define a route in Flask?

@url

@route

@app.route

@path

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does methods=['POST'] in a Flask route do?

Allows both GET and POST

Restricts the route to only POST requests

Restricts the route to only GET requests

Converts all requests to POST

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you visit /save in the browser when it only allows POST?

It shows a success message

It saves empty data

It raises a Method Not Allowed error

It redirects to /get

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which object is used to access form data sent in a POST request?

session

request.form

render_template_string

json.load

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does @app.route('/') define?

The error handler

The homepage (root route)

The session storage

The database connection

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does return render_template_string() do?

Loads a template file from /templates

Renders raw HTML given as a string

Returns plain text only

Reads an HTML file from disk

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?