Online Exam Quiz

questionQuestion  1 to 30

What is the purpose of Django's get_object_or_404 function?

  • To get an object from the database or return a 404 error
  • To get a form from the database
  • To get a view from the database
  • To get a URL from the database
Mark for review

Which of the following is a valid Django model method?

  • str
  • unicode
  • repr
  • init
Mark for review

What is the purpose of Django's settings.py file?

  • To define the URL patterns
  • To define the models
  • To configure the application settings
  • To define the views
Mark for review

Which of the following is a Django template tag?

  • {% include %}
  • {{ include }}
  • {{ block }}
  • {% block %}
Mark for review

How do you add a URL pattern in Django?

  • Using a dictionary
  • Using a list
  • Using a tuple
  • Using a function
Mark for review

Which of the following is a valid field type in Django models?

  • TextField
  • StringField
  • CharacterField
  • CharField
Mark for review

What is the purpose of Django's urls.py file?

  • To define the database models
  • To configure the application settings
  • To define URL patterns
  • To define the business logic
Mark for review

Which command is used to create database migrations in Django?

  • python manage.py migrate
  • python manage.py makemigrations
  • python manage.py syncdb
  • python manage.py createdb
Mark for review

Which of the following is a valid Django form field?

  • CharField
  • IntegerField
  • EmailField
  • All of the above
Mark for review

Which command is used to create a Django superuser?

  • python manage.py createsuperuser
  • python manage.py createsuper
  • python manage.py superuser
  • python manage.py createadmin
Mark for review

Which of the following is a valid Django template tag for a for loop?

  • {% loop item in items %}
  • {% for item in items %}
  • {% iterate item in items %}
  • {% each item in items %}
Mark for review

What is the purpose of Django's views.py file?

  • To configure the application settings
  • To define the URL patterns
  • To define the business logic for the application
  • To create and handle database models
Mark for review

Which of the following is a valid Django template tag for including another template?

  • {% include "template.html" %}
  • {% load "template.html" %}
  • {% render "template.html" %}
  • {% template "template.html" %}
Mark for review

Which command is used to start a new Django project?

  • django-admin startproject
  • django startproject
  • django-admin newproject
  • django newproject
Mark for review

What is the use of the migrate command in Django?

  • To create a new database
  • To create new models
  • To apply and synchronize database migrations
  • To rollback database changes
Mark for review

What is the purpose of Django's csrf_token template tag?

  • To enable CSRF protection
  • To define URL patterns
  • To create an HTTP response
  • To configure the application settings
Mark for review

What is the purpose of Django's forms.py file?

  • To define URL patterns
  • To define database models
  • To create and handle web forms
  • To configure application settings
Mark for review

What is the purpose of Django's models.py file?

  • To define the URL patterns
  • To configure the application settings
  • To define database models
  • To handle HTTP requests
Mark for review

What is the purpose of Django's request.FILES attribute?

  • To access uploaded files
  • To access form data
  • To access query parameters
  • To access session data
Mark for review

Which of the following is a valid Django template filter?

  • {{ name
  • lower }}
  • {{ name
  • capitalize }}
Mark for review

What is the purpose of Django's request.method attribute?

  • To check the HTTP method of the request
  • To check the HTTP status of the request
  • To check the HTTP headers of the request
  • To check the HTTP body of the request
Mark for review

Which file is used to configure URLs in a Django project?

  • settings.py
  • urls.py
  • models.py
  • views.py
Mark for review

Which of the following is a valid HTTP status code?

  • 200
  • 700
  • 800
  • 900
Mark for review

What does the 404 HTTP status code signify?

  • OK
  • Not Found
  • Forbidden
  • Bad Request
Mark for review

Which command is used to collect static files in Django?

  • python manage.py collectstatic
  • python manage.py gatherstatic
  • python manage.py staticcollect
  • python manage.py gatherfiles
Mark for review

What is the default port for Django's development server?

  • 8000
  • 8080
  • 5000
  • 3000
Mark for review

How do you access form data in Django views?

  • Using request.POST
  • Using request.GET
  • Using request.FORM
  • Using request.DATA
Mark for review

How do you define a model in Django?

  • Using a class that inherits from models.Model
  • Using a function that returns a dictionary
  • Using a list of tuples
  • Using a dictionary
Mark for review

What is the purpose of Django's request.GET attribute?

  • To access query parameters
  • To access form data
  • To access uploaded files
  • To access session data
Mark for review

What is the purpose of Django's as_view() method?

  • To define URL patterns
  • To convert a class-based view into a view function
  • To render a template
  • To handle HTTP requests
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review