Quiz Space

Modern Application Development I · Quiz 1 · 27 Oct 2024 · September 2024 term

Question 7: Consider the following Python code and select correct out…

Question 7

+3 marksOne correct option

Consider the following Python code and select correct output.

python
from jinja2 import Template
class Loan:
def __init__(self, accno, loan_amount, interest_rate):
self.accno = accno
self.loan_amount = loan_amount
self.interest_rate = interest_rate
def get_loan_details(self):
return (self.accno, self.loan_amount, self.interest_rate)
loan1 = Loan(101, 45900, 5)
loan2 = Loan(102, 170000, 6)
tm1 = Template("Account1 : {{l1.get_loan_details()}}")
tm2 = Template("Account2 : {{l2.get_loan_details()}}")
print(tm1.render(l1=loan1))
print(tm2.render(l2=loan2))
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

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

More questions from this paper

  1. Q1Suppose a Gamer wants to buy a Bluetooth earphone which can give him a good gaming experience, for that the delay betwe…
  2. Q2Figure question
  3. Q3Consider the following HTML code and select the correct rendered output from the following.
  4. Q4Consider the following code block and select the correct option regarding the output when we run the python file app.py…
  5. Q5The following Python code snippet generates the output on the terminal. Which of the following is the correct output?
  6. Q6The directory listing of a folder and the content of each of its files are given below. Directory Listing: Filename: ba…
  7. Q8Figure question
  8. Q9A certain network connection with a bandwidth of 10 Mbps allows making 1000 requests to a server per second. If each re…
  9. Q10Consider the following Python code snippet. Filename: app.py If the above flask app is run using the command python app…
  10. Q11Figure question
  11. Q12Figure question
  12. Q13Consider the flask code below. Assume that the above flask application is running on http://127.0.0.1:5000 . Which of t…
  13. Q14Consider the following code snippet. Assume the database has a "product" table represented by class "Product" which has…
  14. Q15Consider the following code and answer the given subquestions. form.html app.py
  15. Q16Consider the following code and answer the given subquestions. form.html app.py