Question 1
Which of the following correctly represents the components of the given URL?
Which of the following correctly represents the components of the given URL?
Consider the following flask app and an HTML file in templates folder:
Python file: app.py
from flask import Flask, render_templateapp = Flask(__name__)
my_list = ['Web development','onlinedegree','cs2003', 'MAD-I','Data_science']
@app.route('/')def render(): return render_template('index.html', my_list = my_list)
app.run(debug = True)Template file:
<!DOCTYPE html><head> <style> body{width: 200px; border: 2px solid black} #one{color:red;} #two{color:blue;} </style></head><body> {% for item in my_list %} {% set Length = item|length %} {% if Length%2 == 0 %} <h3 id = "one">{{ item }}</h3> {% else %} <h3 id = "two">{{ item }}</h3> {% endif %} {% endfor %}</body>If the above flask app is running locally on http://127.0.0.1:5000/, what will be rendered by the browser for the base URL?
Consider the flask code given below.
Python file: app.py
from flask import Flask, jsonify, request
app = Flask(__name__)
my_shops= [ { 'name of the shop' : 'Grocery', 'items' : [ { 'item1' : 'Toothpaste', 'item2' : 'Snacks', 'item3' : 'Biscuits', 'item4' : 'Soaps' } ] }]@app.route('/')def show_shop(): return jsonify({"shops" : my_shops})
#====================== CODE HERE#======================
if __name__ == '__main__': app.run()Which of the following code snippets must be added in the given space of above application, in order to create a new shop in ‘my_shops’ list on the server side apart from the existing one?
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.
The IIT Madras BS Modern Application Development I (MAD 1) End Term paper sat on 7 Aug 2022, in the May 2022 term: 32 questions for 100 marks in 180 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.
| Feature | MAD 1 End Term 7 Aug 2022 at a glance |
|---|---|
| Term | May 2022 term |
| Subject | Modern Application Development I |
| Course code | BSCS2003 |
| Questions | 32 |
| Marks | 100 |
| Duration | 180 min |
| MCQ | 25 |
| MSQ | 6 |
| Numerical | 1 |
| Official paper | IIT M FOUNDATION DIPLOMA ENDTERM QPD1 07 Aug 2022 IBA NS |
| Negative marking | No negative marking. |
| Updated |