All Coursera Quiz Answers

Module quiz: Django REST framework Quiz Answers

In this article i am gone to share Coursera Course: APIs by Meta Week 2 | Module quiz: Django REST framework Quiz Answers with you..

Also visit:ย  Module quiz: REST APIs Quiz Answers

 

Module quiz: Django REST framework Quiz Answers

Question 1)
How do you accept a GET, POST and PUT call to a function-based view using an API decorator?

  • @api_view(‘GET’,’POST’,’PUT’)
  • An API endpoint cannot accept multiple HTTP methods
  • api_view([‘GET’,’POST’,’PUT’])
  • @api_view([‘GET’,’POST’,’PUT’])

Question 2)
What are the benefits of using a serializer? Choose all that apply.

  • It helps to authenticate API calls
  • It can save data to a database
  • It can automatically convert data to JSON or XML
  • It can convert model instances to native Python data types
  • It can validate data
  • It can convert user input and map it to models

Question 3)
Which of the following are valid serializer classes in DRF? Choose all that apply.

  • ModelSerializer
  • PrimaryKeySerializer
  • HyperLinkModelSerializer
  • RelationshipSerializer
  • Serializer

Question 4)
You can access the data attribute of a serializer class at any time.

  • True
  • False

Question 5)
Which of the following renderers comes with DRF by default? Choose all that apply.

  • HTML Renderer
  • XML Renderer
  • YAML Renderer
  • JSON Renderer

Question 6)
Which of the following statement is true about DRF?

  • Learning DRF is tough
  • DRF is a standalone framework
  • DRF doesnโ€™t work with different database engines
  • DRF is built for API development

Question 7)
Which of the following panels are available in the DDT or Django debug toolbar? Choose all that apply.

  • Profiling
  • Network
  • Throttle
  • SQL
  • Headers

Question 8)
To serialize a queryset that returns more than one item, which of the following arguments is necessary for the serializer class?

  • related=True
  • many=True
  • multiple_items=True

Question 9)
Which of the following statements are true about using renderers? Choose all that apply.

  • If no Accept header is present, DRF uses JSON renderer by default.
  • Renderers need an Accept header to work properly
  • You cannot use multiple renderers in a project
  • Renderers can automatically convert the output
  • You cannot forcefully use a single renderer

Question 10)
How do you display related model fields as hyperlinks? Choose all that apply.

  • Using HyperlinkedRelatedField
  • Using RelationshipSerializer
  • Using HyperlinkedModelSerializer
  • A ModelSerializer can do it automatically