Quiz Space

Modern Application Development I · Quiz 1 · 23 Feb 2025 · January 2025 term

MAD 1 Quiz 1 23 Feb 2025 — Question 15

Question 15

+3 marksOne correct option

app.py

python
import sys
from string import Template as T1
from jinja2 import Template as T2
temp = "The book title is $title and it costs {{price}}."
if sys.argv[1] == 'jinja 2':
temp = T1(temp)
out = temp.substitute({'title': 'Python Basics', 'price': '$20'})
elif sys.argv[1] == 'string':
temp = T2(temp)
out = temp.render({'title': 'Python Basics', 'price': '$20'})
else:
out = 'Invalid input'
print(out)

Based on the above program, answer the given subquestions.

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

Correct answer

  • B

Question 15 of 16 in the IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 23 Feb 2025, in the January 2025 term (IIT M DIPLOMA AN EXAM QDD2 23 Feb 2025). It carries 3 marks.

More questions from this paper

  1. Q1Figure question
  2. Q2Figure question
  3. Q3Read the statements given below carefully and select the correct option.\ Statement 1: If an element that belongs to tw…
  4. Q4Which of the following options represents a one-to-one relationship in the Entity-Relationship Diagram?
  5. Q5Consider the following HTML document: How will the browser render the above HTML document?
  6. Q6Consider the following HTML code: What is the colour of the printed text “IITM Online BS Degree Program”?
  7. Q7Consider the template code and Python code given below: Template code: “output.html” Python code: “main.py” What will t…
  8. Q8Consider the following Python code snippet: Python code: “main.py” The above file will result in the output as “2.8”, f…
  9. Q9Consider two python files, mad1.py and mad2.py with following code snippets. File1: mad1.py File2: mad2.py What is the …
  10. Q10Figure question
  11. Q11Figure question
  12. Q12A server S requests to retrieve data from two data centers DC_1 and DC_2, which are located at distances of D_1 and D_2…
  13. Q13Consider two fictitious addressing systems, IPv5 and IPv8, used to store the IP address of a machine. Following are the…
  14. Q14Consider the following code: What will the output of the above PyHTML code be?
  15. Q16app.py Based on the above program, answer the given subquestions.