Quiz Space

Modern Application Development I · Quiz 2 · 3 Aug 2025 · May 2025 term

Question 10: Consider the following flask application. If the applica…

Question 10

+4.5 marksOne correct option

Consider the following flask application.

python
from flask import Flask, abort
app = Flask(__name__)
users = ["admin", "user_1", "user_2", "user_3"]
@app.route('/home/<string:username>', methods = ['POST'])
def home(username):
if username in users:
return f"<h1>Hello {username}, Welcome!</h1>"
else:
abort(407)
@app.errorhandler(404)
def user_error_1(error):
return "<h1>The user you are looking for is invalid.</h1>"
@app.errorhandler(405)
def user_error_2(error):
return "<h1>Please check the web request.</h1>"
@app.errorhandler(407)
def user_error_4(error):
return "<h1>Proxy authentication required.</h1>"
app.run()

If the application is running locally on http://127.0.0.1:5000. What will be rendered on the browser for the URL http://127.0.0.1:5000/home/user_4 ?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 10 of 16 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 2 paper sat on 3 Aug 2025, in the May 2025 term (IIT M DEGREE AN EXAM QDB2 03 Aug 2025). It carries 4.5 marks.

More questions from this paper

  1. Q1You manage a datacenter where each server has a 10 Gigabit per second network connection and the facility’s backbone li…
  2. Q2Which of the following statements BEST describes a key advantage of Jinja2 server-side rendering over JavaScript/JSON-b…
  3. Q3Figure question
  4. Q4What is the right syntax to use an external JavaScript file(.js) into the current html file?
  5. Q5Figure question
  6. Q6Consider the following Python code. File name: main.py What is the correct output of the given code?
  7. Q7Consider the following Python code snippet. Which of the following statements, when substituted in place of === OUTPUT …
  8. Q8Consider the following Flask app code. Assume the above flask app runs on “http://127.0.0.1:5000/” and is accessed thro…
  9. Q9Consider the following HTML code. Filename: main.html
  10. Q11Which of the following statements is/are false about caching in REST APIs?
  11. Q12Which of the following is/are correct with respect to storing data in graphs?
  12. Q13Consider the Flask Restful API code given below: File name: app.py Assume that the Flask server is running on http://12…
  13. Q14Figure question
  14. Q15Consider the following sqlalchemy code and answer the given subquestions:
  15. Q16Consider the following sqlalchemy code and answer the given subquestions: