0
0
Flaskframework~20 mins

What is Flask - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Flask Framework Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is Flask used for?
Flask is a popular tool in Python. What is its main purpose?
ATo manage databases directly without code
BTo build websites and web apps easily with Python
CTo create desktop applications with graphical interfaces
DTo analyze data and create charts
Attempts:
2 left
💡 Hint
Think about what web developers need to create websites.
🧠 Conceptual
intermediate
1:30remaining
Which feature is NOT part of Flask?
Flask provides many features. Which one is NOT included by default?
ARouting to handle different web pages
BSupport for handling HTTP requests and responses
CTemplate rendering to create HTML pages
DBuilt-in database ORM (Object Relational Mapper)
Attempts:
2 left
💡 Hint
Flask is minimal and lets you add extra tools as needed.
component_behavior
advanced
2:00remaining
What happens when you run this Flask code?
Consider this Flask app code. What will the browser show when visiting '/'?
Flask
from flask import Flask
app = Flask(__name__)

@app.route('/')
def home():
    return 'Hello, Flask!'

if __name__ == '__main__':
    app.run()
AThe browser shows the text: Hello, Flask!
BThe browser shows a 404 Not Found error
CThe browser shows a blank page
DThe server crashes with an error
Attempts:
2 left
💡 Hint
Look at the route decorator and the returned string.
📝 Syntax
advanced
2:00remaining
Identify the syntax error in this Flask snippet
Which option correctly fixes the syntax error in this Flask code? from flask import Flask app = Flask(__name__) @app.route('/') def home() return 'Hi!' app.run()
AAdd parentheses to app.run like app.run()
BChange @app.route('/') to @app.route('/home')
CAdd a colon after def home():
DIndent the return statement one level less
Attempts:
2 left
💡 Hint
Check the function definition line carefully.
lifecycle
expert
2:30remaining
What is the order of events when a Flask app handles a web request?
Put these steps in the correct order when Flask processes a web request: 1. Flask calls the view function 2. Browser sends HTTP request 3. Flask sends HTTP response back 4. Flask matches URL to route
A1,2,3,4
B1,3,2,4
C2,1,3,4
D1,2,4,3
Attempts:
2 left
💡 Hint
Think about what happens first: the browser sends a request or Flask matches routes?