Bird
0
0

Given this Flask app code, what will be the output when accessing the root URL /?

medium📝 component behavior Q13 of 15
Flask - Ecosystem and Patterns
Given this Flask app code, what will be the output when accessing the root URL /?
from flask import Flask
app = Flask(__name__)

@app.route('/')
def home():
    return 'Welcome to Flask!'
AWelcome to Flask!
BEmpty page
C500 Internal Server Error
D404 Not Found error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze route decorator

    The route '/' is defined and linked to the home() function.
  2. Step 2: Check function return value

    The home() function returns the string 'Welcome to Flask!'. Flask sends this as the response body.
  3. Final Answer:

    Welcome to Flask! -> Option A
  4. Quick Check:

    Route '/' returns string output [OK]
Quick Trick: Route '/' returns function's string output [OK]
Common Mistakes:
MISTAKES
  • Expecting error instead of string output
  • Confusing route URL with function name
  • Thinking Flask returns empty page by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes