Q.1 Which view can be used to show the detail of an object?
1. ListView
2. DetailView
3. TemplateView
4. View
Ans: 2. DetailView
Q.2 There are many error views by default in Django. Identify the incorrect one.
1. http_forbidden()
2. server_error()
3. permission_denied()
4. bad_request()
5. page_not_found()
Ans: 1. http_forbidden()
Q.3 Which view decorator module can be used to restrict access to views based on the request method?
1. django.views.decorators.vary
2. django.views.decorators.gzip
3. django.views.decorators.http
4. django.views.decorators.cache
Ans: 3. django.views.decorators.http
Q.4 Mixins are a form of multiple inheritance where behaviors and attributes of multiple parent classes can be combined.
1. True
2. False
Ans: 1. True
Q.5 Which shortcut function returns the result of filter() on a given model manager cast to a list, raising Http404 if the resulting list is empty?
1. get_object_or_404()
2. render()
3. get_list_or_404()
4. render_to_response()
Ans: 3. get_list_or_404()
No comments:
Post a Comment
If you have any doubts, Please let us know.