Django MCQs with answers Page - 62

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 of the following is not a built-in template filter in Django?

  • (A) date
  • (B) length
  • (C) truncatechars
  • (D) strformat

S

Shyam Dubey • 1.88K Points
Master

Q. Which of these is used to create relationships between Django models?

  • (A) models.Relation()
  • (B) models.ForeignKey()
  • (C) models.Join()
  • (D) models.Link()

S

Shyam Dubey • 1.88K Points
Master

Q. Which class is used to build a form from a model?

  • (A) forms.ModelForm
  • (B) forms.FormBuilder
  • (C) forms.FieldForm
  • (D) forms.AutoForm

S

Shyam Dubey • 1.88K Points
Master

Q. How can you order a QuerySet in descending order by a field?

  • (A) order_by('-fieldname')
  • (B) order('-fieldname')
  • (C) orderby(desc(fieldname))
  • (D) sort(fieldname, desc=True)

S

Shyam Dubey • 1.88K Points
Master

Q. Which function loads a template from disk in Django?

  • (A) load_template()
  • (B) render_to_response()
  • (C) get_template()
  • (D) open_template()

S

Shyam Dubey • 1.88K Points
Master

Q. What is the default file for defining project-level settings in Django?

  • (A) manage.py
  • (B) urls.py
  • (C) settings.py
  • (D) wsgi.py

S

Shyam Dubey • 1.88K Points
Master

Q. Which method is called after a form is validated in a class-based CreateView?

  • (A) form_cleaned()
  • (B) form_valid()
  • (C) after_validation()
  • (D) save_form()

S

Shyam Dubey • 1.88K Points
Master

Q. Which file type is commonly used to store translations in Django?

  • (A) .json
  • (B) .po
  • (C) .lang
  • (D) .txt

S

Shyam Dubey • 1.88K Points
Master

Q. Which method is used to redirect users to another URL in Django views?

  • (A) redirect()
  • (B) move()
  • (C) forward()
  • (D) goto()