Unit 1: Introduction to Django - Practice Quiz
1 What is Django?
2 Which programming language is primarily used with Django?
3 Which architectural pattern does Django commonly follow?
4
Which command is commonly used to install Django with pip?
pip create django
django setup pip
pip install django
python install django
5 Which command can display the installed Python version?
python --django
python --start
python --version
python --install
6 Which editor feature helps developers run Django commands without leaving the editor?
7 What should normally be opened as the workspace folder in a code editor?
8 What does a Django project usually represent?
9 What is a Django app designed to provide?
10 Can one Django project contain multiple apps?
11 Which Django project file contains settings such as installed apps and database configuration?
settings.py
tests.py
models.py
views.py
12 Which project file usually defines the main URL routes?
apps.py
urls.py
admin.py
models.py
13
What is the purpose of the wsgi.py file in a Django project?
14
Which command creates a Django project named mysite?
django-admin migrate mysite
django-admin runserver mysite
django-admin startproject mysite
django-admin startapp mysite
15 Which command starts Django's development server?
python manage.py shellserver
python manage.py runserver
python manage.py collectapp
python manage.py startproject
16
What is manage.py mainly used for?
17 Which command applies pending database migrations?
python manage.py runserver
python manage.py testserver
python manage.py migrate
python manage.py startapp
18 Which file in a Django app is commonly used to define database models?
views.py
models.py
admin.py
apps.py
19 Which file in a Django app commonly contains request-handling functions or classes?
tests.py
apps.py
models.py
views.py
20
Which command creates a Django app named blog?
python manage.py runapp blog
python manage.py startproject blog
python manage.py startapp blog
python manage.py migrate blog
21 A team must quickly build a database-backed employee portal with authentication and an administrative interface. Why is Django a suitable choice?
22 Which sequence correctly installs Django in an isolated environment for a new project?
manage.py, and install the editor
pip install django
23 A computer has several Python installations. Which command most reliably checks the Django version available to the Python interpreter currently being used?
pip create django --version
python manage.py install django
python -m django --version
django-admin startproject --version
24
Django runs correctly from an activated virtual environment, but the editor reports that django imports cannot be resolved. What should be checked first?
25 An online store needs separate functionality for products, customer accounts, and payments. Which Django organization is most appropriate?
manage.py files for each feature
products, accounts, and payments apps
26
A reviews component may be reused in a bookstore site and a movie site. Which design best supports this goal?
settings.py file
manage.py so every Django project can execute it without installing an app
27
After running django-admin startproject portal, which file should be edited to add an installed app and configure a database?
portal/manage.py
portal/portal/asgi.py
portal/portal/urls.py
portal/portal/settings.py
28
A developer wants requests beginning with /blog/ to be handled by the blog app. Which project file normally contains the top-level URL mapping?
project_package/urls.py
blog/admin.py
project_package/settings.py
blog/models.py
29 A deployment platform requires an ASGI callable for an asynchronous-compatible deployment. Which generated file exposes the appropriate application object?
settings.py
asgi.py
manage.py, after rewriting it to create and operate a permanent asynchronous production server
wsgi.py
30
A developer is already inside an empty directory named schoolsite and wants manage.py created directly in that directory without another nested outer folder. Which command should be used?
python manage.py startproject config
django-admin startapp config .
django-admin startproject config
django-admin startproject config .
31
Which command starts Django's development server on local port 8080?
python manage.py runserver, followed by editing settings.py to permanently replace Django's default port
python manage.py runserver 8080
django-admin runserver --port 8080
python manage.py startserver 8080
32 The initial Django project contains migration files for built-in apps, but their database tables do not yet exist. Which command applies them?
python manage.py migrate
python manage.py collectstatic
python manage.py inspectdb
python manage.py makemigrations
33
Why is python manage.py <command> commonly used after a Django project has been created instead of django-admin <command>?
manage.py replaces the need for a Python interpreter
manage.py converts every command into a database migration and applies it before the requested operation begins
manage.py automatically points commands to the project's settings
manage.py installs missing dependencies before every command
34 A developer wants Django to detect common configuration problems without starting the server or modifying the database. Which command is most appropriate?
python manage.py shell
python manage.py testserver
python manage.py check
python manage.py migrate
35
A developer is adding a database-backed Article entity to a newly created app. In which file should the model class normally be defined?
admin.py
apps.py
models.py
views.py
36
A Product model already exists, and the developer wants it to appear in Django's administration interface. Which app file is normally updated to register it?
admin.py
migrations/__init__.py, where all administration registrations and generated schema changes should be combined
apps.py
tests.py
37
What is the primary purpose of the migrations directory inside a Django app?
38
From the directory containing manage.py, which command correctly creates an app named inventory?
django-admin createapp inventory
python manage.py startapp inventory
python inventory manage.py startapp
python manage.py startproject inventory
39
An app named inventory has been created, but Django does not detect its models when makemigrations is run. What is the most likely missing step?
inventory or its app configuration to INSTALLED_APPS
manage.py into the inventory app directory
models.py file to database.py
MIDDLEWARE so Django loads its models before processing every incoming HTTP request
40
A developer creates a blog app and defines views in it, but visiting /blog/ still produces a 404 response. Which integration step is required?
startapp blog again after the development server has started
settings.py module
41 A Django view retrieves records through the ORM, renders them with a template, and returns an HTTP response. Which mapping most accurately describes Django's MTV architecture in this request?
42
Django was installed successfully with pip install django, but python -m django --version reports No module named django. Which diagnosis is most likely?
startproject
pip installed Django for a different Python interpreter than the one invoked by python
django-admin, not as a Python module
DJANGO_SETTINGS_MODULE has been explicitly defined
43
A developer wants to guarantee that Django is installed into the currently activated virtual environment, even when multiple pip executables exist on PATH. Which command is the most reliable?
pip install Django --global
python -m pip install Django
django-admin install Django
python django-admin install
44
A Django project runs correctly from a terminal with its virtual environment activated, but the editor marks every django import as unresolved. What is the most appropriate correction?
sys.path
manage.py
45 A team is building an e-commerce site with independently reusable inventory, payment, and review functionality. Which design best follows Django's project-and-app model?
manage.py file
46 An app package exists inside a Django project and can be imported successfully, but Django does not discover its models during normal application loading. Which omission most directly explains this?
AppConfig is absent from INSTALLED_APPS
manage.py
settings.py module
47
After running django-admin startproject config, which file is intended primarily as the command-line entry point and normally sets DJANGO_SETTINGS_MODULE before delegating to Django?
config/urls.py
config/__init__.py
config/asgi.py
manage.py
48
A generated project's inner package is renamed from config to core, but no file contents are updated. Running python manage.py check now fails to import the settings module. Which reference must be updated to address this immediate failure?
DJANGO_SETTINGS_MODULE in manage.py from config.settings to core.settings
WSGI_APPLICATION in settings.py from config.wsgi to core.urls
BASE_DIR in settings.py from config to core
ROOT_URLCONF in settings.py from config.urls to core.settings
49
A developer is already inside an existing repository root and wants manage.py placed there while creating the project package as config/. Which command is appropriate?
python manage.py startproject config .
django-admin startapp config .
django-admin startproject config .
django-admin startproject . config
50
A directory already contains a file named manage.py. What should a developer expect when running django-admin startproject config . in that directory?
config package
manage_1.py
51
Why does python manage.py check usually work without a --settings argument, while a directly invoked django-admin check may require settings configuration?
manage.py sets the project's default DJANGO_SETTINGS_MODULE before executing commands
django-admin supports only commands that do not depend on project settings
manage.py embeds all settings directly and never imports a settings module
django-admin searches exclusively for settings inside installed application packages
52
A project has config/settings/dev.py and config/settings/prod.py, and no usable default settings module. Which command explicitly runs system checks with the development settings?
python manage.py check --settings=config.settings.dev
python manage.py check --config=config.settings.dev
python manage.py check --settings=config/settings/dev.py
python manage.py --settings config.settings.dev check
53
A developer changes a model class and immediately runs python manage.py migrate, but no database alteration occurs. Assuming the app is installed correctly, which missing action best explains the result?
python manage.py makemigrations to generate a migration first
python manage.py check to translate the model directly into SQL
python manage.py collectstatic to register the changed schema
python manage.py startapp to rebuild the application's model registry
54
A development server must accept connections from other machines on the local network using port 9000. Which command requests the required binding?
python manage.py runserver 127.0.0.1:9000
python manage.py runserver 0.0.0.0:9000
python manage.py runserver localhost:9000
python manage.py runserver --public 9000
55
In a newly generated Django app, which file is specifically intended to define application metadata and startup configuration through a subclass of AppConfig?
apps.py
admin.py
tests.py
models.py
56
A migration file imports migrations and defines dependencies and operations but is never detected by Django. The filename is valid and the app is installed. Which structural problem is most likely?
models.py
admin.py module
migrations Python package
urls.py
57
A developer runs python manage.py startapp reports, sees the new package, and then runs makemigrations reports. Django responds that no installed app has the label reports. What is the most likely cause?
ROOT_URLCONF
settings.py
INSTALLED_APPS
manage.py
58
An app is stored at company/modules/billing, and its AppConfig.name is company.modules.billing. Which INSTALLED_APPS entry most explicitly selects that configuration class?
company.modules.billing.apps.BillingConfig
company.modules.billing.models.BillingConfig
company.modules.billing.BillingConfig
company.modules.billing.apps.Billing
59
A developer wants startapp to populate an already existing directory /srv/project/modules/audit. Which command has the correct argument structure?
django-admin startapp /srv/project/modules/audit audit
django-admin startproject audit /srv/project/modules/audit
python manage.py createapp /srv/project/modules/audit audit
django-admin startapp audit /srv/project/modules/audit
60 A deployment server needs a synchronous WSGI callable, while another server needs an asynchronous ASGI callable. Which generated modules expose these interfaces by default?
asgi.py exposes application for WSGI, and wsgi.py exposes application for ASGI
wsgi.py exposes application for WSGI, and asgi.py exposes application for ASGI
manage.py exposes wsgi_application, and urls.py exposes asgi_application
settings.py exposes both callables directly through INSTALLED_APPS
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →