Quiz Space

Modern Application Development I · Quiz 1 · 26 Oct 2025 · September 2025 term

Question 16: Consider the following Flask code: login.html Based on t…

Question 16

+3 marksOne correct option

Consider the following Flask code:

python
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/login', method="GET")
def login(id):
name = request.form.get('name', 'Guest')
return render_template("login.html", name=name)
if __name__ == '__main__':
app.run(debug=True)

login.html

html
<body>
{{ name }}
<form action="/login" method="POST">
<input type="text" name="name" placeholder="Enter your name">
<button type="submit">Submit</button>
</form>
</body>

Based on the above data, answer the given subquestions.

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

Correct answer

  • B

Question 16 of 16 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 26 Oct 2025, in the September 2025 term (IIT M DIPLOMA AN EXAM QDD2 26 Oct 2025). It carries 3 marks.

More questions from this paper

  1. Q1Which of the following is the correct syntax to display the total number of courses in a Jinja2 template?
  2. Q2Consider the following code: app.py You are running a Flask web application locally using the command: python app.py. O…
  3. Q3Figure question
  4. Q4Figure question
  5. Q5Consider two Python files, main.py and utils.py with the following code snippets. File1: main.py File2: utils.py What i…
  6. Q6Figure question
  7. Q7Consider the following Python code snippet. If the above Python code runs on the terminal, which of the following state…
  8. Q8Figure question
  9. Q9Consider the following HTML and CSS code: What is the total width (approximately ) of the div with class="container" an…
  10. Q10Consider the following code: You are building a Flask web application that takes user input from an HTML form and displ…
  11. Q11Figure question
  12. Q12Figure question
  13. Q13Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  14. Q14Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  15. Q15Consider the following Flask code: login.html Based on the above data, answer the given subquestions. From the given op…