Django MCQs with answers Page - 5

Dear candidates you will find MCQ questions of Django here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

S

Shyam Dubey • 1.88K Points
Master

Q. Which command is used to collect all static files into one location?

  • (A) python manage.py collectfiles
  • (B) python manage.py collectstatic
  • (C) python manage.py static
  • (D) python manage.py gatherstatic

S

Shyam Dubey • 1.88K Points
Master

Q. Which of these is a valid template tag for rendering variables?

  • (A) [[ variable ]]
  • (B) {{ variable }}
  • (C) <%= variable %>
  • (D) [= variable =]

S

Shyam Dubey • 1.88K Points
Master

Q. What does Django use to handle sessions by default?

  • (A) Cookies only
  • (B) File system
  • (C) Database
  • (D) Cache

S

Shyam Dubey • 1.88K Points
Master

Q. Which of the following is not a generic class-based view?

  • (A) TemplateView
  • (B) RedirectView
  • (C) DeleteView
  • (D) AppView

S

Shyam Dubey • 1.88K Points
Master

Q. Which of the following manages app configuration in Django?

  • (A) settings.py
  • (B) apps.py
  • (C) config.py
  • (D) init.py

S

Shyam Dubey • 1.88K Points
Master

Q. Which template tag is used to render blocks defined in base templates?

  • (A) display
  • (B) load
  • (C) block
  • (D) extends

S

Shyam Dubey • 1.88K Points
Master

Q. Which of the following settings is used to configure user-uploaded media?

  • (A) STATIC_URL
  • (B) MEDIA_URL
  • (C) UPLOAD_PATH
  • (D) MEDIA_ROOT_PATH

S

Shyam Dubey • 1.88K Points
Master

Q. How can you define a one-to-one relationship in Django?

  • (A) models.OneToManyField
  • (B) models.ForeignKey(unique=True)
  • (C) models.OneToOneField
  • (D) models.SingleRelationField

S

Shyam Dubey • 1.88K Points
Master

Q. Which command is used to apply migration files to the database?

  • (A) python manage.py build
  • (B) python manage.py migrate
  • (C) python manage.py sync
  • (D) python manage.py apply

S

Shyam Dubey • 1.88K Points
Master

Q. What does QuerySet's filter() method return?

  • (A) Single object
  • (B) Dictionary
  • (C) List of models
  • (D) QuerySet