Quiz Space

Modern Application Development I · Quiz 1 · 13 Jul 2025 · May 2025 term

MAD 1 Quiz 1 13 Jul 2025 — Question 13

Question 13

+2 marksOne correct option

Consider the following Python code snippet and answer the given subquestions

Filename: webapp.py

python
import sys
from jinja2 import Template
args = sys.argv
frameworks = {
'django': 'python',
'react': 'javascript',
'flask': 'python',
'vue': 'javascript'
}
languages = {
'python': 'server-side',
'javascript': 'client-side'
}
template = Template("{{ framework }} is a {{ lang_type }} {{ language }} framework.")
if len(args) >= 3 and args[1] in frameworks:
framework_name = args[1]
language = frameworks[framework_name]
if args[2] == 'type' and language in languages:
lang_type = languages[language]
print(template.render(framework=framework_name, language=language, lang_type=lang_type))
else:
print("Invalid second argument or language not found!")
else:
print("Invalid command")
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 13 of 16 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 13 Jul 2025, in the May 2025 term (IIT M DIPLOMA AN EXAM QDD2 13 July 2025). It carries 2 marks.

More questions from this paper

  1. Q1What will be the output of the following HTML code?
  2. Q2Figure question
  3. Q3Consider the following HTML code snippet. filename: index.html Which elements from the above document will have a red b…
  4. Q4Consider the following Python code snippet. Filename: code.py Which of the following statements will throw a key error?
  5. Q5What will be the output of the following Jinja2 template when rendered in Flask?
  6. Q6Consider the following Flask code snippet: Assume the above code is running on server http://127.0.0.1:5000/ . What wil…
  7. Q7Consider the following code: What will be the color of the paragraph text when rendered in a browser?
  8. Q8Consider the following Python file “output.py” File: “output.py” Which of the following code snippet when placed at \<!…
  9. Q9Consider the following Python code snippet: main.py We are executing above main.py in command line with command python …
  10. Q10We want to use an online grammar checking tool, which takes each word from the client and sends it to the web server. T…
  11. Q11Consider a client which is located 3000 km from the server makes a request through the cable. Suddenly after the reques…
  12. Q12Consider the following Python code snippet and answer the given subquestions Filename: webapp.py
  13. Q14Consider the following Python code snippet and answer the given subquestions Filename: webapp.py
  14. Q15Given the following code, answer the given subquestions:
  15. Q16Given the following code, answer the given subquestions: