Question 1
A client sends a signal to a satellite 36,000 km above Earth. Speed of electromagnetic waves in vacuum = 3 × 10⁸ m/s. Compute RTT for client ↔ satellite.
0.24 s
0.36 s
0.48 s
0.72 s

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 2 paper sat on 23 Nov 2025, in the September 2025 term: 16 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
A client sends a signal to a satellite 36,000 km above Earth. Speed of electromagnetic waves in vacuum = 3 × 10⁸ m/s. Compute RTT for client ↔ satellite.
0.24 s
0.36 s
0.48 s
0.72 s
Correct answer
0.24 s
Consider the following flask app.
from flask import Flaskapp = Flask(__name__)
@app.route('/')def home(): return "Home"
@app.route('/hello')@app.route('/hi')def greet(): return "Hello World!"
@app.route('/hello/<name>')def greet_name(name): return f"Hello {name}"
if __name__ == "__main__": app.run()What will be the output if you visit 127.0.0.1:5000/hello ?
"Hello World!"
"Home"
404 Not Found
"Hello /hello"
Correct answer
"Hello World!"
Consider the following flask app.
from flask import Flaskapp = Flask(__name__)
@app.route('/data')def data_get(): return "GET Data"
@app.route('/data/<int:id>')def data_id(id): return f"Data ID: {id}"
if __name__ == "__main__": app.run()If a POST request is sent to 127.0.0.1:5000/data/5, what will be the output on the browser?
"GET Data"
"Data ID: 5"
405 Method Not Allowed
404 Not Found
Correct answer
405 Method Not Allowed
Consider the following flask app.
from flask import Flaskapp = Flask(__name__)
@app.route('/post/<int:id>')@app.route('/post/<string:id>')def post(id): return f"Post ID: {id}"
@app.route('/post')def all_posts(): return "All posts"
if __name__ == "__main__": app.run()What will be the output on the browser, if you visit 127.0.0.1:5000/post/23?
Post ID: 23
"All posts"
404 Not Found
Flask throws AssertionError
Correct answer
Post ID: 23
Consider the following code:
app.py
from flask import Flaskapp = Flask(__name__)
@app.route("/")def port(): return "This is the same port question."
if __name__ == "__main__": app.run(port=0000)You are running a Flask web application locally using the command: python app.py. On which URL will the application be accessible in the browser?
Correct answer
Match the Flask-RESTful components with their correct description/role:
1 → A, 2 → B, 3 → C, 4 → D
1 → E, 2 → C, 3 → B, 4 → A
1 → B, 2 → C, 3 → A, 4 → D
1 → B, 2 → C, 3 → A, 4 → E
Correct answer
1 → B, 2 → C, 3 → A, 4 → E
What happens if you don’t return a proper dictionary/JSON in Flask-Restful API methods?
Returns None
Raises an error that the value is not serializable
Converts into plain text
Automatically converts into JSON format
Correct answer
Raises an error that the value is not serializable
Consider the following table.
Which of the following matches is correct?
i - c, ii - a, iii - d, iv - b
i - d, ii - c, iii - a, iv - b
i - b, ii - c, iii - d, iv - a
i - d, ii - c, iii - b, iv - a
Correct answer
i - d, ii - c, iii - b, iv - a
Consider the following Flask SQLalchemy code.
What is true about the credits column?
It is an auto-increment column.
If the value is not provided, it takes 3.
It is an auto-increment that starts from 3.
It can’t store a value other than 3.
Correct answer
If the value is not provided, it takes 3.
Consider the following Flask code:
File name: app.py
from flask import Flask, requestapp = 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 ### ?
return str(int(argv1)+int(argv2))
return int(argv1)+int(argv2)
return argv1+argv2
return str(int(argv1+argv2))
Correct answer
return str(int(argv1)+int(argv2))
Consider the following Flask code:
File name: main.py
import sysfrom flask import Flask
app = Flask(__name__)
def do_product(): if len(sys.argv) > 1: nums = [int(x) for x in sys.argv[1:]] product = 1 for n in nums: product *= n return product return None
@app.route("/")def index(): result = do_product() return f"<h3>Product is: {result}</h3>"
app.run(debug=True)Choose the different ways of executing “main.py” and rendering results when the app is running on http://127.0.0.1:5000?
Correct answers
Consider the URL:
**https://example.com:8080/index.html?user=admin\#section2**\
Which of the following is/are True?
https is the protocol.
8080 is the default port of HTTPS.
index.html is the html file which got rendered.
user=admin is part of the query string.
#section2 is sent to the server as part of the request.
Correct answers
https is the protocol.
index.html is the html file which got rendered.
user=admin is part of the query string.
Match the JavaScript event binding method with its correct description:
1 → A, 2 → B, 3 → C, 4 → E
1 → B, 2 → A, 3 → C, 4 → E
1 → B, 2 → A, 3 → C, 4 → D
1 → A, 2 → B, 3 → D, 4 → C
Correct answer
1 → B, 2 → A, 3 → C, 4 → E
Consider the following JavaScript output methods. Which of these statements is/are true?
Correct answers
You are building a Flask-RESTful API with the following code:
from flask import Flask, request, jsonifyfrom flask_restful import Resource, Api
app = Flask(__name__)api = Api(app)
class Hello(Resource): def get(self, message="No Data Found"): return {"message": "Hello, World!"}
def post(self): data = request.get_json() return {"received": data}, 201
api.add_resource(Hello, '/hello')
if __name__ == '__main__': app.run(debug=True)Which of the following statements is/are true?(Select all that apply)
The Api class automatically handles URL routing for all resources
This API will return HTML content when accessed via a browser
Correct answers
The Api class automatically handles URL routing for all resources
Consider the following table students:
Which of the following SQL queries will return the names of students who are 20 years old and have grade 'A'?
SELECT name FROM students WHERE age = 20 AND grade = 'A';
SELECT * FROM students WHERE age = 20 OR grade = 'A';
SELECT name FROM students WHERE students.age = 20 AND grade = 'A';
SELECT name FROM students WHERE student.grade = 'A' OR student.age = 20;
Correct answers
SELECT name FROM students WHERE age = 20 AND grade = 'A';
SELECT name FROM students WHERE students.age = 20 AND grade = 'A';