---Advertisement---
Django Microservices Web Framework

Django – Web Framework Interview Question-Answer

By smart_answer13

Published on:

---Advertisement---

Q.1 Sessions are __________.

       A. File-based

       B. Cookie-based

       C. cached

       D. Database-backend

       E. All the options

Ans : All the options


Q.2 Identify the incorrect middleware hook.

       A. process_template_response()

       B. template_view()

       C. process_exception()

       D. process_view()

Ans : template_view()


Q.3 urlpatterns should be a python list of ______ instances.

       A. re_path()

       B. path()

       C. both options

       D. None of the options

Ans : both options


Q.4 Identify the incorrect path argument.

       A. view

       B. route

       C. model

       D. name

Ans : model


Q.5 By default, Django serializes session using ________.

       A. json

       B. pickle

       C. both options

       D. None of the options

Ans : json


Q.6 Which is a valid path converter?

       A. slug

       B. int

       C. str

       D. uuid

       E. str and int

       F. All the options

Ans : All the options


Q.7 A custom path converter is a class that includes _______.

       A. regex string

       B. to_url(self,value) method

       C. to_python(self, value) method

       D. All the options

Ans : All the options


Q.8 Which view decorator module can be used to control server and client-side caching?

       A. django.views.decorators.cache

       B. django.views.decorators.vary

       C. django.views.decorators.http

       D. django.views.decorators.gzip

Ans : django.views.decorators.cache


Q.9 HttpRequest object is automatically created by Django when a page is refreshed.

       A. True

       B. False

Ans : True


Q.10 Mixins are a form of multiple inheritance where behaviors and attributes of multiple parent classes can be combined.

       A. True

       B. False

Ans : True


Q.11 Generic views ____________.

       A. Display list and detail pages for a single object

       B. Present date-based objects in year/month/day archive pages

       C. Allow users to create, update, and delete objects

       D. All the options

Ans : All the options


Q.12 Which view can be used to show the detail of an object?

       A. ListView

       B. DetailView

       C. View

       D. TemplateView

Ans : DetailView


Q.13 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?

       A. get_list_or_404()

       B. render()

       C. render_to_response()

       D. get_object_or_404()

Ans : get_list_or_404()


Q.14 There are many error views by default in Django. Identify the incorrect one.

       A. http_forbidden()

       B. bad_request()

       C. permission_denied()

       D. server_error()

       E. page_not_found()

Ans : http_forbidden()


Q.15 Which view decorator module can be used to restrict access to views based on the request method?

       A. django.views.decorators.gzip

       B. django.views.decorators.http

       C. django.views.decorators.cache

       D. django.views.decorators.vary

Ans : django.views.decorators.http


Q.16 Which filter is available if {% load humanize %} is used in template?

       A. intcomma

       B. intword

       C. apnumber

       D. naturalday

       E. naturaltime

       F. sdasd

       D. All the options

Ans : All the options


Q.17 When a template system encounters a dot, it tries _______.

       A. Dictionary lookup

       B. Numeric index lookup

       C. Attribute or method lookup

       D. All the options

Ans : All the options


Q.18 Since the template language doesn’t provide exception handling, any exception raised from a template filter will be exposed as a server error.

       A. True

       B. False

Ans : True


Q.19 You cannot have spaces or punctuation characters in variable names.

       A. True

       B. False

Ans : True


Q.20 Which option does Django templates accept?

       A. context_processors

       B. autoescape

       C. libraries

       D. loaders

       E. All the options

Ans : All the options


Q.21 When {% extends %} is used for inheriting a template?

       A. It can be used anywhere in the template

       B. It should be the first template tag in the template

       C. It should follow a {% base %} template tag in the template

       D. It should be the last template tag in the template

Ans : It should be the last template tag in the template


Q.22 Which template configuration defines a list of directories where the engine should look for template source files, in search order?

       A. OPTIONS

       B. APP_DIRS

       C. DIRS

       D. BACKEND

Ans : DIRS


Q.23 Which filter is available if {% load humanize %} is used in template?

       A. apnumber

       B. intcomma

       C. naturalday

       D. intword

       E. naturaltime

       F. All the options

Ans : All the options


Q.24 filesizeformat filter in a template, provides the output in a human readable format.

       A. True

       B. False

Ans : True


smart_answer13

---Advertisement---

Related Post

Zipkin-Jaeger Interview Question-Answer

Q.1 Which is responsible for sending spans to storage?        A. Transport        B. Collector        C. Component        D. ...

Weaveworks Interview Question-Answer

Q.1 Which of the following features offered by WeaveClouds?        A. Observability        B. VCS integration        C. none of the mentioned ...

Vaadin Unplugged Interview Question-Answer

Q.1 Which of the Programming Model is not supported by Vaadin?        A. Browser        B. Client Side        C. Server Side ...

Spring Boot Framework Interview Question-Answer Part – 2

Q.1 The annotation used to import additional configuration classes is ___________.        A. @Import        B. @Include        C. @EnableImport     ...

Leave a Comment