Quiz Space

Modern Application Development I · Quiz 2 · 1 Dec 2024 · September 2024 term

Question 7: Consider the following flask code. If the flask server is…

Question 7

+3 marksOne or more correct options

Consider the following flask code.

python
from flask import Flask
import json
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Car:
def __init__(self, brand, model):
self.brand = brand
self.model = model
def __str__(self) -> str:
result = {
"brand": self.brand,
"model": self.model,
}
return str(result)
class MyApi(Resource):
def get(self, brand, model):
c = Car(brand, model)
return json.dumps(c, default=vars)
api.add_resource(MyApi, "/api/<string:brand>/<string:model>")
app.run(debug=True)

If the flask server is running locally on “http://127.0.0.1:5000/”. Which of the following URLs will result in a Not Found error?

Select all that apply.

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

Correct answers

  • C
  • D

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

More questions from this paper

  1. Q1You have a DRAM module with bus width of 64 bits, clock speed of 800 MHz, and operating in DDR (double-data-rate or two…
  2. Q2Figure question
  3. Q3Consider the following python code. Consider that the above code is running locally on “http://127.0.0.1:5000”. What wi…
  4. Q4Consider the following flask application. app.py Which of the following statements is/are true if the application is ru…
  5. Q5Consider the following flask application. app.py Which of the following statements is/are true if the application is ru…
  6. Q6Consider the following HTML document “form.html” and the flask route given in “app.py”. Assume all the required methods…
  7. Q8Consider the flask code below. Assume that the above flask application is running on http://127.0.0.1:5000. Which of th…
  8. Q9Consider a character set Q, which consists of only those characters used in the sentence, "the five boxing wizards jump…
  9. Q10We are trying to create two models ‘Student’ and ‘Assignment’ and they are related by one-to- many relationship(i.e., o…
  10. Q11What will be returned on the terminal 2 for the command:
  11. Q12What will be returned on the terminal 2 for the command:
  12. Q13Which of the following statements are correct?
  13. Q14Identify the correct order of tasks that take place when a client makes a request on the URL: https://example.com/home.…
  14. Q15Consider the following statements and select the correct option.\ Statement 1: Redundancy is used to improve performanc…
  15. Q16The term “stateless” in the context of a server means that _