Django

Django

Test your Django knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What command is used to create a new Django project?

    • django-admin startproject
    • django startproject
    • django-admin createproject
    • django newproject
  2. Where do you define URL routes in a Django project?

    • views.py
    • urls.py
    • settings.py
    • admin.py
  3. Which function is used to render HTML templates in Django?

    • render_template()
    • return_template()
    • render()
    • template()
  4. What does the Django ORM allow you to do?

    • Design HTML pages
    • Connect APIs
    • Interact with the database
    • Manage static files
  5. Which file contains all the project-wide settings in Django?

    • config.py
    • settings.py
    • env.py
    • project.py
  6. What is the main benefit of using Django’s class-based views (CBVs)?

    • Better performance
    • Easier to write SQL queries
    • Reusability and structure
    • Compatibility with Python 2
  7. Which class-based view would you use to update an object?

    • DetailView
    • UpdateView
    • ListView
    • FormView
  8. What is a mixin in Django CBVs?

    • A database function
    • A reusable class with methods
    • A template tag
    • A database migration
  9. What does select_related() do in Django ORM?

    • Selects related templates
    • Performs lazy loading
    • Performs a JOIN for foreign keys
    • Deletes related objects
  10. Which ORM method allows you to filter many-to-many relationships?

    • values()
    • all()
    • filter()
    • prefetch_related()
  11. What is the purpose of Django middleware?

    • Modify templates
    • Process request/response globally
    • Manage URL routing
    • Connect to databases
  12. How do you connect a signal to a receiver function in Django?

    • use signal.send()
    • use connect() method
    • use dispatch()
    • use link()
  13. What signal is sent after a model instance is saved?

    • pre_save
    • model_save
    • post_save
    • after_save
  14. What is ASGI in Django?

    • API Server Gateway Interface
    • Asynchronous Server Gateway Interface
    • Advanced SQL Gateway Interface
    • Application Server Graph Interface
  15. Which Django version added native async view support?

    • 2.2
    • 3
    • 3.1
    • 4