Quiz Space

Modern Application Development I · Quiz 2 · 23 Nov 2025 · September 2025 term

Question 10: Consider the following Flask code: File name: app.py If …

Question 10

+3 marksOne correct option

Consider the following Flask code:

File name: app.py

python
from flask import Flask, request
app = Flask(__name__)
@app.route('/calculate')
def calculate():
argv1 = request.args.get('x')
argv2 = request.args.get('y')
### Missing code ###
app.run(debug=True)

If the app is running on http://127.0.0.1:5000 and the calculate function calculates the sum of two integers then which of the following options should correctly replace the ### Missing code ### ?

  1. A

    return str(int(argv1)+int(argv2))

  2. B

    return int(argv1)+int(argv2)

  3. C

    return argv1+argv2

  4. D

    return str(int(argv1+argv2))

Show answer

Correct answer

  • A

    return str(int(argv1)+int(argv2))

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

More questions from this paper

  1. Q1A client sends a signal to a satellite 36,000 km above Earth. Speed of electromagnetic waves in vacuum = 3 × 10⁸ m/s. C…
  2. Q2Consider the following flask app. What will be the output if you visit 127.0.0.1:5000/hello ?
  3. Q3Consider the following flask app. If a POST request is sent to 127.0.0.1:5000/data/5, what will be the output on the br…
  4. Q4Consider the following flask app. What will be the output on the browser, if you visit 127.0.0.1:5000/post/23?
  5. Q5Consider the following code:\ app.py You are running a Flask web application locally using the command: python app.py. …
  6. Q6Match the Flask-RESTful components with their correct description/role:
  7. Q7What happens if you don’t return a proper dictionary/JSON in Flask-Restful API methods?
  8. Q8Consider the following table. Which of the following matches is correct?
  9. Q9Consider the following Flask SQLalchemy code. What is true about the credits column?
  10. Q11Consider the following Flask code: File name: main.py Choose the different ways of executing “main.py” and rendering re…
  11. Q12Consider the URL:\ https://example.com:8080/index.html?user=admin#section2\ Which of the following is/are True?
  12. Q13Match the JavaScript event binding method with its correct description:
  13. Q14Consider the following JavaScript output methods. Which of these statements is/are true?
  14. Q15You are building a Flask-RESTful API with the following code: Which of the following statements is/are true?(Select all…
  15. Q16Consider the following table students: Which of the following SQL queries will return the names of students who are 20 …