Quiz Space

Modern Application Development I · Quiz 1 · 26 Oct 2025 · September 2025 term

Question 7: Consider the following Python code snippet. If the above …

Question 7

+3 marksOne or more correct options

Consider the following Python code snippet.

python
from jinja2 import Template as JTemplate
from string import Template as STemplate
data = {'name1': 'Alice', 'name2': 'name1',
'age1': '25', 'age2': 'age1',
'job1': 'Engineer', 'job2': 'job1'}
jt = JTemplate("{{name2}} is {{age2}} years old and works as a {{job2}}.")
result1 = jt.render(data)
print(result1) #first print statement
st = STemplate(result1)
result2 = st.substitute(data)
print(result2) #second print statement

If the above Python code runs on the terminal, which of the following statements is/are correct?

Select all that apply.

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

Correct answers

  • A
  • C
  • D

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

More questions from this paper

  1. Q1Which of the following is the correct syntax to display the total number of courses in a Jinja2 template?
  2. Q2Consider the following code: app.py You are running a Flask web application locally using the command: python app.py. O…
  3. Q3Figure question
  4. Q4Figure question
  5. Q5Consider two Python files, main.py and utils.py with the following code snippets. File1: main.py File2: utils.py What i…
  6. Q6Figure question
  7. Q8Figure question
  8. Q9Consider the following HTML and CSS code: What is the total width (approximately ) of the div with class="container" an…
  9. Q10Consider the following code: You are building a Flask web application that takes user input from an HTML form and displ…
  10. Q11Figure question
  11. Q12Figure question
  12. Q13Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  13. Q14Consider the following Python code snippet. Filename: server.py Based on the above data, answer the given subquestions.
  14. Q15Consider the following Flask code: login.html Based on the above data, answer the given subquestions. From the given op…
  15. Q16Consider the following Flask code: login.html Based on the above data, answer the given subquestions.