Quiz Space

Modern Application Development I · Quiz 1 · 7 Jul 2024 · May 2024 term

Question 3: What will be the output of the following Python code?

Question 3

+2 marksOne correct option

What will be the output of the following Python code?

python
from jinja2 import Template
data = {"id": 101, "prod_name": "Groceries", "sales_amt": 5600,
"sales_bonus": 5}
def foo(amount, p):
return amount * p / 100
a = foo(data["sales_amt"], data["sales_bonus"])
t = Template(
"Congratulations, you got bonus {{ bonus }} by selling product
{{data['prod_name']}}"
)
output = t.render(data=data, bonus=a)
print(output)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

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

More questions from this paper

  1. Q1Which of the following is not a correct perceivable accessibility principle?
  2. Q2Which of the below HTTP status codes represents the client error?
  3. Q4Consider the below table. Use the above table. Which of the below match is correct?
  4. Q5A certain movie with advertisements is being streamed by the client on the internet with a bandwidth of 5 Mbps. If the …
  5. Q6Figure question
  6. Q7The following Python code snippet generates the output on the terminal. Which of the following is the correct output?
  7. Q8Consider the following HTML document. What will be the rendered output if an additional style is added via the ID selec…
  8. Q9Consider the following Python code snippet. Filename: app.py If the above flask app is run using the command python app…
  9. Q10Consider the following Python code snippet. Filename: module.py How will the browser render the output of the above cod…
  10. Q11Consider the following HTML document. How will the browser render above HTML file?
  11. Q12Consider a client A that makes a request to server B that fetches the information from Datacenter C which in turn fetch…
  12. Q13Consider the following flask app and the bodies of two index.html files shown in the figure below. app.py app_templates…
  13. Q14What can be inferred from the Entity-Relationship Diagram below:
  14. Q15Consider the following Flask code. File name: sum_args.py Select the command(s) to execute the above code without any e…
  15. Q16Consider the following Python code and HTML document. HTML document: templates/index.html Assume that the flask server …