Quiz Space

Modern Application Development I Quiz 2: 10 July 2022 (May 2022 term)

Question 1

+3 marksOne or more correct options

Consider the Python file and a template given below.
Python file: app.py

python
from flask import Flask, url_for, redirect, render_template
app = Flask(__name__)
@app.route("/<name>/")
def index1(name):
return "Hi" + " " + name + "!" + " " + "This is your home page."
@app.route("/first_index/<string:name>")
def index2(name):
if name == "XYZ":
return redirect(url_for("index1", name = "XYZ"))
else:
return redirect( url_for("index3"))
@app.route("/second_index")
def index3():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)

Template file: index.html

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Document</title>
</head>
<body>
<h2> You are on the incorrect page.</h2>
<a href="{{ url_for("index1", name="ABC") }}">Go back</a>
</body>
</html>

If the above flask application is running locally on the URL ‘http://127.0.0.1:5000’, which of the following statements is/are true about the above code snippet?

Select all that apply.

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

Question 2

+3 marksOne correct option

A flask application is given below.

python
from flask import Flask, jsonify
app = Flask(__name__)
Gadgets = [
{"tech":"Smartwatch, Digital camera"},
{"mobile":"Headphones, Speakers"},
{"Laptop":"Keyboard, Mouse"}
]
@app.route("/home", methods=["GET"])
def func1():
return jsonify({"The list of gadgets": Gadgets})
@app.route("//")
def rest_lists():
return {
"Restaurant 1" : "Hotel Alpine",
"Restaurant 2" : "Maurya Vihar",
"Restaurant 3" : "Royal Garden"
}
if __name__ == "__main__":
app.run(debug=True)

If the above flask application is running locally on the URL ‘http://127.0.0.1:5000’, which of the following statement is true about the above flask application?

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

Question 3

+3 marksOne correct option

Consider the table “production” in SQLite database given below:

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

13 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the MAD 1 Quiz 2 10 Jul 2022 paper

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 2 paper sat on 10 Jul 2022, in the May 2022 term: 16 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureMAD 1 Quiz 2 10 Jul 2022 at a glance
TermMay 2022 term
SubjectModern Application Development I
Course codeBSCS2003
Questions16
Marks50
Duration120 min
MSQ1
MCQ15
Official paperIIT M DIPLOMA QUIZ2 EXAM QPE1 10 July 2022
Negative markingNo negative marking.
Updated

Same Quiz 2, other subjects

More MAD 1