Online Exam Quiz

questionQuestion  1 to 30

What is the file extension for Django template files?

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

Which of the following is a valid Django template tag?

  • {% url %}
  • <% url %>
  • {{ url }}
  • [[ url ]]
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 purpose of Django's urls.py file in an app directory?

  • Define URL patterns specific to the app
  • Define view functions
  • Define database models
  • Define admin configurations
Mark for review

How do you add a static file directory in Django?

  • Add to STATICFILES_DIRS in settings.py
  • Add to TEMPLATES in settings.py
  • Add to MEDIA_ROOT in settings.py
  • Add to INSTALLED_APPS in settings.py
Mark for review

How do you access the Django admin interface?

  • /admin
  • /dashboard
  • /control
  • /manage
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 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

How do you define a URL pattern in Django?

  • path('url/', view_name)
  • url('url/', view_name)
  • urlpatterns = [url('url/', view_name)]
  • urlpatterns = [path('url/', view_name)]
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 app?

  • django createapp
  • django-admin startapp
  • django-admin createapp
  • django startapp
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 Django's models.py file?

  • Define view functions
  • Define database models
  • Define URL patterns
  • Define admin configurations
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

How do you filter query results in Django ORM?

  • Using filter() method
  • Using exclude() method
  • Using all() method
  • Using get() method
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

What is the default primary key field type in Django models?

  • IntegerField
  • CharField
  • AutoField
  • BigAutoField
Mark for review

Which middleware component handles user authentication in Django?

  • AuthenticationMiddleware
  • SessionMiddleware
  • CommonMiddleware
  • CsrfViewMiddleware
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 purpose of Django's views.py file?

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

What is the purpose of Django's admin.site.register function?

  • Register models with the admin site
  • Register views with the admin site
  • Register URLs with the admin site
  • Register templates with the admin site
Mark for review

Which of the following is the default database for Django?

  • SQLite
  • MySQL
  • PostgreSQL
  • Oracle
Mark for review

What does the static template tag do in Django?

  • Link to static files
  • Include JavaScript files
  • Link to CSS files
  • Include media files
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

What does the login_required decorator do in Django?

  • Restrict access to logged-in users
  • Restrict access to admin users
  • Restrict access to superusers
  • Restrict access to anonymous users
Mark for review

What is Django?

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

What is the purpose of Django's signals?

  • Allow decoupled applications to get notified
  • Define view functions
  • Define database models
  • Define URL patterns
Mark for review

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

  • Define forms
  • Define models
  • Define URL patterns
  • Define admin configurations
Mark for review

How do you include a URLconf from another app in urls.py?

  • include('app_name.urls')
  • include app_name.urls
  • include[app_name.urls]
  • include.app_name.urls
Mark for review

How do you perform a raw SQL query in Django?

  • MyModel.objects.raw('SELECT * FROM mytable')
  • MyModel.objects.query('SELECT * FROM mytable')
  • MyModel.objects.execute('SELECT * FROM mytable')
  • MyModel.objects.sql('SELECT * FROM mytable')
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