Quiz Space

Modern Application Development I · Quiz 2 · 24 Mar 2024 · January 2024 term

Question 1: Consider the following code. If the flask application is …

Question 1

+2 marksOne correct option

Consider the following code.

python
from flask import Flask
app = Flask(__name__)
@app.route('/home')
def home1():
return "This is homepage 1"
@app.route('/home/')
def home2():
return "This is homepage 2"
@app.errorhandler(404)
def page_not_found(e):
return 'page not found'
app.run(debug=True)

If the flask application is running on http://127.0.0.1:5000, what will browser render for URL http://127.0.0.1:5000/home/

  1. A

    Page not found

  2. B

    This is homepage 1

  3. C

    This is homepage 2

  4. D

    Code will throw error

Show answer

Correct answer

  • C

    This is homepage 2

Question 1 of 16 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 2 paper sat on 24 Mar 2024, in the January 2024 term (IIT M DIPLOMA AN EXAM QDD2 24 Mar 2024). It carries 2 marks.

More questions from this paper

  1. Q2Consider the following Flask code snippet. If the application is running on a local server for the URL: https://127.0.0…
  2. Q3Consider the below statements about Cookies:\ Statement 1: Cookies enable the web app to recognize the users\ Statement…
  3. Q4Consider the below Flask code snippet: If the application is running locally, what will be the status code and mimetype…
  4. Q5Consider a character set M, which consists of only those characters used in the statement, "sphinx of black quartz judg…
  5. Q6Consider the following Python code snippet. Which of the following statements, when substituted in place of === OUTPUT …
  6. Q7Figure question
  7. Q8Figure question
  8. Q9Consider the following Python code snippet. What will be the output of the code on the terminal?
  9. Q10Consider the following Python code snippet. What will be the output of the above code on the terminal for the command:
  10. Q11Consider the following flask application. app.py Which of the following statements is/are true if the application is ru…
  11. Q12Consider the following flask application. app.py Which of the following statements is/are true if the application is ru…
  12. Q13Consider the following flask application. app.py Which of the following statements is/are true if the application is ru…
  13. Q14Figure question
  14. Q15Consider the following HTML document and select the correct option(s).
  15. Q16Consider the following api resources created using flask_restful. Assume that the app is connected to the database and …