MAD 1 Quiz 1: 16 October 2022 (September 2022 term)
The IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 16 Oct 2022, in the September 2022 term: 17 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.
- 17
- 50
- 120 min
- 13
- 3
- 1
Show answer
Correct answer
Question 2
Show answer
Correct answer
Question 3
Consider the following Python code snippet.
from jinja2 import Templatetemp = """{% for num in seq|reject("even") %}{{ num+2 }}{% endfor %}"""seq = [6,5,71,13,30,22]output = Template(temp)print(output.render(seq = seq))What will be the output if the given code is executed?
Show answer
Correct answer
Question 4
Consider the following Python code snippet.
(Concept: Python string and Jinja2 templates)
from string import Template as T1from jinja2 import Template as T2
info = {'girl1': 'Mary', 'girl2': 'Samantha', 'girl3': 'girl2', 'girl4': 'girl1', 'city1':'Moscow', 'city2':'city1'}
t1 = T1("{{$girl3}} and {{$girl4}} arrived at the {{$city2}} station earlyand waited for the bus.")
out1 = t1.substitute(info)
out2 = T2(out1)
print(out2.render(info))What will be the output on the terminal?
Show answer
Correct answer
Question 5
Consider the code snippets given below.
(Concept: HTML and CSS)
File 1: index.html:
<head> <link rel="stylesheet" href="style.css"></head><body> <h3>The CSS Box Model</h3> <div class="my_border box"> <h3 class="title">Border</h3> <div class="my_padding box"> <h3 class="title">Padding</h3> <div class="my_content box"> <h3 class="title">Content</h3> <div> <div> <div></body>File 2: style.css:
div.my_border {background-color: purple; border: 2px dotted grey; height: 130px; width: 130px;}
div.my_padding {background-color: lightblue; height: 80px; width: 80px;}
div.my_content {background-color: yellow; height: 40px; width: 45px; }
.title {text-align: left; font-size: 10px; font-style: italic;}
.box{margin: 10px 20px; padding: 0px;}What will be rendered by the browser, when the above HTML file is loaded?
Show answer
Correct answer
Question 6
Consider the following Python code given below.
(Concept: Flask and concepts of HTTP methods)
from flask import Flask, request, url_for
app = Flask(__name__)
@app.route('/dashboard')def dashboard(): return 'This is the dashboard'
@app.route('/user/<username>')def user(username): return f'This is {username} profile'
@app.route('/login', methods=['GET', 'POST'])def login(): if request.method == 'POST': return(url_for('user', username='your_name')) else: return (url_for('dashboard'))
if __name__ == '__main__': app.run(debug=True)If the above flask application is running on URL “http://127.0.0.1:5000”, which of the following is the correct output if a user visits the URL “http://127.0.0.1:5000/login”, using a browser?
Show answer
Correct answer
Question 7
Show answer
Correct answer
Question 8
Show answer
Correct answer
Question 9
Show answer
Correct answer
Question 10
Consider the below HTML and CSS styling.
<html> <head> <style> h3 { color: green; } .content { color: red; } </style> </head> <body> <h3 class = "content">This is the main Content</h3> <button onclick = "remove_class"> Click Me </button> </body></html>Assuming clicking the button with the text “Click Me” removes the class “content” from the “h3” element, what will be the text colour of the text placed inside the “h3” element, before and after clicking the button with the text “Click Me” (Assume a normal browser is used which shows black text on white background)?
Show answer
Correct answer
Question 11
Show answer
Correct answer
Question 12
Show answer
Correct answer
Question 13
Show answer
Correct answers
Question 14
Which of the following option(s) will generate the HTML code equivalent to the below HTML code?
[Concepts covered: Programmatic HTML generation]
<!DOCTYPE html><html> <head> <title>My title</title> </head> <body> <div> <div> <h2>inside title</h2> </div> <p>some text in a paragraph</p> </div> </body></html>Show answer
Correct answers
Question 15
Show answer
Correct answer: 6
Question 16
Based on the above data, answer the given subquestions.
Show answer
Correct answers
Question 17
Based on the above data, answer the given subquestions.
What S_Id(s) is/are returned by the following SQL query for the given instance of the relational tables?
select R.S_Id from Student S join Result R on S.S_Id=R.S_id joinCourse C on R.C_Id=C.C_Id where R.Marks>70 and S.City='Chennai' andC.Course_name='MAD1'Show answer
Correct answer
