Online Exam Quiz

questionQuestion  1 to 30

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

  • Define view functions
  • Define database models
  • Define URL patterns
  • Define admin configurations
Mark for review

How do you run a Django development server?

  • django-admin runserver
  • django runserver
  • python manage.py runserver
  • python runserver
Mark for review

Which command is used to apply migrations to the database in Django?

  • python manage.py migrate
  • python manage.py makemigrations
  • django-admin migrate
  • django-admin applymigrations
Mark for review

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

  • Configure the database
  • Configure the project
  • Configure the URLs
  • Configure the models
Mark for review

What is the file extension for Django template files?

  • .html
  • .py
  • .dt
  • .tpl
Mark for review

What does the __str__ method do in Django models?

  • Define the string representation of the model
  • Define the model's fields
  • Define the model's methods
  • Define the model's admin interface
Mark for review

How do you cache a view in Django?

  • Using cache_page decorator
  • Using cache_view decorator
  • Using cache decorator
  • Using cache_response decorator
Mark for review

What is the use of the context parameter in Django views?

  • Pass data to templates
  • Pass data to models
  • Pass data to forms
  • Pass data to admin interface
Mark for review

What is the purpose of the migrate command in Django?

  • Create new apps
  • Create database schema
  • Run unit tests
  • Create views
Mark for review

What is the use of the Django Rest Framework?

  • Create RESTful APIs
  • Create web pages
  • Create database models
  • Create URL patterns
Mark for review

How do you create a Django superuser?

  • python manage.py createsuperuser
  • python manage.py superuser
  • django-admin createsuperuser
  • django-admin superuser
Mark for review

How do you specify a one-to-one relationship in Django models?

  • models.OneToOneField
  • models.ForeignKey
  • models.ManyToManyField
  • models.OneToManyField
Mark for review

Which of the following is not a valid Django model field type?

  • CharField
  • EmailField
  • TextField
  • DictField
Mark for review

What is the purpose of the reverse function in Django?

  • Reverse a string
  • Reverse a list
  • Get the URL for a given view
  • Reverse a queryset
Mark for review

How do you access the Django admin interface?

  • /admin
  • /dashboard
  • /control
  • /manage
Mark for review

How do you extend a base template in Django?

  • {% extend %}
  • {% base %}
  • {% extends %}
  • {% template %}
Mark for review

How do you start a new Django project?

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

How do you filter query results in Django ORM?

  • Using filter() method
  • Using exclude() method
  • Using all() method
  • Using get() method
Mark for review

Which middleware component handles user authentication in Django?

  • AuthenticationMiddleware
  • SessionMiddleware
  • CommonMiddleware
  • CsrfViewMiddleware
Mark for review

How do you serve media files in Django during development?

  • Add MEDIA_URL and MEDIA_ROOT in settings.py
  • Add STATIC_URL in settings.py
  • Add TEMPLATES in settings.py
  • Add INSTALLED_APPS in settings.py
Mark for review

What is the use of the get_object_or_404 function in Django views?

  • Query the database
  • Retrieve an object or return 404
  • Handle form submissions
  • Render a template
Mark for review

What is the purpose of the Django Debug Toolbar?

  • Debug Django applications
  • Test Django applications
  • Profile Django applications
  • Secure Django applications
Mark for review

What is Django?

  • A Python framework
  • A JavaScript library
  • A CSS framework
  • A database
Mark for review

Which command is used to create migrations based on model changes?

  • python manage.py migrate
  • python manage.py makemigrations
  • django-admin migrate
  • django-admin makemigrations
Mark for review

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

  • Define admin interface
  • Define database models
  • Define URL patterns
  • Define middleware
Mark for review

Which command is used to create a new Django app?

  • django createapp
  • django-admin startapp
  • django-admin createapp
  • django startapp
Mark for review

What is the purpose of the urls.py file in a Django project?

  • Define database models
  • Define view functions
  • Define URL patterns
  • Define middleware
Mark for review

How do you start a new Django app?

  • django createapp
  • django-admin startapp
  • django-admin createapp
  • django startapp
Mark for review

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

  • Define allowed hosts
  • Define allowed IP addresses
  • Define allowed URLs
  • Define allowed templates
Mark for review

Which of the following is the default database for Django?

  • SQLite
  • MySQL
  • PostgreSQL
  • Oracle
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