Quiz Space

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

Question 10: Consider the following code: You are building a Flask we…

Question 10

+4.5 marksOne correct option

Consider the following code:

python
from flask import Flask, request, render_template_string
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
name = request.form['name']
template = "Hello, {{ name }}!"
return render_template_string(template, name=name)
return '''
<form method="POST">
Enter Your Name: <input type="text" name="name">
<button>Submit</button>
</form>
'''
if __name__ == '__main__':
app.run(debug=True)

You are building a Flask web application that takes user input from an HTML form and displays it using Jinja2 templates. Suppose the user runs this app locally and submits the name Alice in the form.

Which of the following represents the correct sequence of concepts that occur when the user submits the form with the name Alice ?

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

Correct answer

  • C

Question 10 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 4.5 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. Q11Figure question
  11. Q12Figure question
  12. Q13Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  13. Q14Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  14. Q15Consider the following Flask code: login.html Based on the above data, answer the given subquestions. From the given op…
  15. Q16Consider the following Flask code: login.html Based on the above data, answer the given subquestions.