Bird
0
0

If a Raspberry Pi web server script uses Flask and defines a route with @app.route('/status'), what will happen when visiting 'http://pi-ip/status'?

medium📝 Predict Output Q5 of 15
Raspberry Pi - Web Server and API
If a Raspberry Pi web server script uses Flask and defines a route with @app.route('/status'), what will happen when visiting 'http://pi-ip/status'?
AThe browser shows a blank page.
BThe server crashes due to missing route.
CThe function linked to '/status' runs and returns its response.
DThe server restarts automatically.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Flask route behavior

    When a URL matches a defined route, Flask runs the linked function and sends its response.
  2. Step 2: Apply to '/status' route

    Visiting '/status' triggers the function decorated with @app.route('/status') to run and respond.
  3. Final Answer:

    The function linked to '/status' runs and returns its response. -> Option C
  4. Quick Check:

    Flask route match = function runs and responds [OK]
Quick Trick: Flask routes run linked functions on matching URLs. [OK]
Common Mistakes:
MISTAKES
  • Assuming server crashes without error
  • Expecting blank page without return
  • Thinking server restarts on route access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes