Quiz Space

Modern Application Development I · Quiz 1 · 16 Oct 2022 · September 2022 term

Question 6: Consider the following Python code given below. (Concept:…

Question 6

+3 marksOne correct option

Consider the following Python code given below.

(Concept: Flask and concepts of HTTP methods)

python
from flask import Flask, request, url_for
app = Flask(__name__)
@app.route('/dashboard')
def dashboard():
return 'This is the dashboard'
@app.route('/user/<username>')
def user(username):
return f'This is {username} profile'
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
return(url_for('user', username='your_name'))
else:
return (url_for('dashboard'))
if __name__ == '__main__':
app.run(debug=True)

If the above flask application is running on URL “http://127.0.0.1:5000”, which of the following is the correct output if a user visits the URL “http://127.0.0.1:5000/login”, using a browser?

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

Correct answer

  • B

Question 6 of 17 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 16 Oct 2022, in the September 2022 term (IIT M QUIZ 1 FOUNDATION DAD DIPLOMA QPD2 16 Oct 2022). It carries 3 marks.

More questions from this paper

  1. Q1Figure question
  2. Q2Figure question
  3. Q3Consider the following Python code snippet. What will be the output if the given code is executed?
  4. Q4Consider the following Python code snippet. (Concept: Python string and Jinja2 templates) What will be the output on th…
  5. Q5Consider the code snippets given below.\ (Concept: HTML and CSS) File 1: index.html: File 2: style.css: What will be re…
  6. Q7Figure question
  7. Q8Figure question
  8. Q9Figure question
  9. Q10Consider the below HTML and CSS styling. Assuming clicking the button with the text “Click Me” removes the class “conte…
  10. Q11Figure question
  11. Q12Figure question
  12. Q13Figure question
  13. Q14Which of the following option(s) will generate the HTML code equivalent to the below HTML code? [Concepts covered: Prog…
  14. Q15Figure question
  15. Q16Based on the above data, answer the given subquestions.
  16. Q17What S_Id(s) is/are returned by the following SQL query for the given instance of the relational tables?