Developer tools & deployment quiz

Django Quiz: Models, Views, Templates, ORM and Deployment MCQs

Test your Django skills: the model-view-template pattern, projects and apps, manage.py commands, settings, models and the ORM, migrations, URLs and views, templates, forms and admin, security and deploying with gunicorn and nginx.

✅ Free · no login60 questions⏱ Timer📝 Explanations🖨 Mark sheet & PDFBeginner to intermediate
Django Quiz: free online quiz with timer and mark sheet by Codanics
Loading…

Django Quiz

60 questions · 8 topics · timer · instant explanations · printable mark sheet.

  • Questions60 in the bank, 10–30 per attempt
  • Levels20 easy · 24 medium · 16 hard
  • TimeAbout 5–20 minutes
  • PriceFree, no login needed
  • Made byDr. Aammar Tufail, Codanics
  • Updated18 November 2026

In short: the Django Quiz is a free online multiple-choice quiz by Codanics with 60 questions on django basics and MVT; projects, apps and manage.py; settings and configuration; models and the ORM; URLs and views; templates; forms and admin; and security, deployment and AI. You choose the number of questions and the difficulty, answer against a timer, see an explanation after every answer and finish with a printable mark sheet.

🚀 Follow Codanics for more free quizzes and lessonsNew quizzes, free lessons, scholarships and PhD positions, straight to your phone.

What the Django Quiz covers

Django lets you turn a Python project, such as an AI agent or a data app, into a real website with users, a database and an admin panel. Its conventions are powerful once you understand how the pieces connect.

This quiz follows the Codanics Django tutorials and the AI agents deployment guide, from your first startproject to running safely on a VPS.

  • Django basics and MVT 6 questions
  • Projects, apps and manage.py 8 questions
  • Settings and configuration 7 questions
  • Models and the ORM 9 questions
  • URLs and views 9 questions
  • Templates 6 questions
  • Forms and admin 6 questions
  • Security, deployment and AI 9 questions

Who it is for: Python developers building web apps, AI engineers who want to put models and agents online, and learners of the Codanics Django course.

How the quiz works

  1. Type your name if you want it printed on the mark sheet (optional; it never leaves your browser).
  2. Choose 10, 20 or 30 questions, a difficulty (Easy, Mixed or Hard) and the timer: Standard, Relaxed or none.
  3. Answer each question before the timer runs out. Press A–D or 1–4 on a keyboard, or tap an option on your phone.
  4. Read the explanation after every answer, then press Next.
  5. At the end, get your score, grade, topic-wise breakdown and a full answer review. Print it or save it as a PDF.
  6. Retake the quiz for a fresh random set, or practise only the topics you found hard.

Free video lessons from Codanics

Score lower than you hoped? These free lessons from the Codanics YouTube channel cover the same topics, explained step by step.

▶ Full playlist: Complete Django tutorials for beginners
Free on the Codanics YouTube channel, taught in Urdu/Hindi.

Sample questions with answers

Here are 10 questions from the bank, with answers and explanations. The quiz above draws from all 60.

1. In Django's MVT architecture, what does the letter T stand for?
  1. Template
  2. Table
  3. Threading
  4. Test

Answer: A. Template
MVT means Model, View, Template. The template is the presentation layer: an HTML file with placeholders that the view fills with data.

2. In Django, what is a view?
  1. An HTML file stored in the templates folder of each app
  2. A database table shown in the admin panel
  3. A Python callable that takes a request and returns a response
  4. A CSS file that controls page layout

Answer: C. A Python callable that takes a request and returns a response
A view (function or class) receives an HttpRequest and must return an HttpResponse. It usually fetches data from models and renders a template.

3. Which command creates a new Django project called mysite?
  1. python manage.py startapp mysite .
  2. django-admin newproject mysite
  3. django-admin startproject mysite
  4. pip install mysite

Answer: C. django-admin startproject mysite
django-admin startproject creates the project folder with manage.py and the settings, urls, wsgi and asgi modules. startapp is for apps inside a project.

4. What is the difference between makemigrations and migrate?
  1. makemigrations applies changes; migrate only checks for errors
  2. Both commands do the same thing, just in different Django versions
  3. migrate creates the model classes; makemigrations deletes old tables
  4. makemigrations writes migration files; migrate applies them to the database

Answer: D. makemigrations writes migration files; migrate applies them to the database
makemigrations compares your models with existing migrations and writes new migration files. migrate runs unapplied migrations against the database.

5. Why must DEBUG be set to False on a live production site?
  1. DEBUG=True makes the database read-only
  2. DEBUG=True disables all templates
  3. DEBUG=False is required before you can use the admin panel at all
  4. Debug error pages reveal code, settings and other sensitive details

Answer: D. Debug error pages reveal code, settings and other sensitive details
With DEBUG=True, errors show detailed tracebacks, local variables and settings to anyone. That information helps attackers, so production must use DEBUG=False.

6. Three books in the table have price=500. What happens when this line runs? (Book.objects.get(price=500))
Book.objects.get(price=500)
  1. It returns the first matching book
  2. It returns a list of three books
  3. It raises MultipleObjectsReturned
  4. It returns None

Answer: C. It raises MultipleObjectsReturned
get() must match exactly one row. Zero matches raise DoesNotExist and more than one raise MultipleObjectsReturned. Use filter() when you expect several results.

7. For path('post/<int:pk>/', views.detail), what does the view receive when a user visits /post/7/?
  1. A keyword argument pk with the integer 7
  2. A keyword argument pk with the string '7'
  3. Only request; the number is ignored
  4. A list [7] in request.GET

Answer: A. A keyword argument pk with the integer 7
The int path converter matches digits and converts them to an int, then passes the value as keyword argument pk: detail(request, pk=7).

8. In a Django template, how do you display the value of a variable called title?
  1. {{ title }}
  2. {% title %}
  3. {# title #}
  4. ${title}

Answer: A. {{ title }}
Double curly braces output a variable. {% %} is for tags such as for and if, and {# #} is a comment.

9. How do you make a Book model appear in the Django admin site?
  1. Add Book to ALLOWED_HOSTS
  2. Run python manage.py startadmin Book in the project folder
  3. Call admin.site.register(Book) in the app's admin.py
  4. Add {% admin Book %} to a template

Answer: C. Call admin.site.register(Book) in the app's admin.py
Registering the model in admin.py tells the admin to generate list, add, edit and delete pages for it.

10. A user types <script>alert(1)</script> as a comment and the template shows {{ comment }}. What happens?
  1. The script runs in every visitor's browser
  2. Django deletes the comment automatically
  3. It is HTML-escaped and shown as plain text
  4. The page fails with a server error

Answer: C. It is HTML-escaped and shown as plain text
Django templates auto-escape variables, converting < and > into HTML entities. This blocks most cross-site scripting (XSS) attacks.

Free guides and blogs to study

Free tools for your studies and research

Codanics also has 160+ free online tools for students and researchers: statistics calculators, meta-analysis, PDF and writing tools. They run in your browser, with no login.

Browse all free tools →

Frequently asked questions

Is the Django Quiz free?

Yes. The Django Quiz is completely free, with no sign-up, no login and no limit on attempts.

How many questions are in the Django Quiz?

The question bank has 60 multiple-choice questions (20 easy, 24 medium and 16 hard) across 8 topics. Each attempt draws 10, 20 or 30 of them at random, so every attempt is different.

How does the timer work?

Each question has its own countdown: about 25 seconds for easy, 40 for medium and 55 for hard questions, plus 15 seconds when there is code to read. Choose Relaxed to double the time or switch the timer off to study at your own pace. Unanswered questions count as skipped.

Can I get a certificate or mark sheet?

Yes. When you finish, you get a mark sheet with your name, score, grade, time, topic-wise performance and every answer explained. Use Print or save as PDF to keep it. It is a self-assessment result, not an official certificate.

Are the answers and explanations correct?

Every question was written and reviewed for one clearly correct answer, and code questions were checked by running the code. If you think an answer is wrong, tell us on the Codanics WhatsApp channel or in the YouTube comments and we will fix it.

Do I need to know Python before the Django quiz?

Yes, basic Python helps: functions, classes and dictionaries. Take the Python Basics Quiz first if you are new.

Does the quiz cover deployment?

Yes, at concept level: DEBUG and ALLOWED_HOSTS, static files, environment variables and serving Django with gunicorn and nginx on a VPS.

Is my data stored anywhere?

No. The quiz runs entirely in your browser. Your name, answers and score are not uploaded. Your best score and settings are remembered only in this browser so you can track your progress.

More free quizzes

See all Codanics quizzes → · Courses · Free tools · Blog

Follow Codanics

Created by Dr. Muhammad Aammar Tufail, Codanics. Published 18 November 2026, last updated 18 November 2026. Found a mistake or want a quiz on another topic? Tell us on the WhatsApp channel or contact us.