Unit 1: Introduction to Django - Practice Quiz

INT253 — Web Development In Python Using Django 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is Django?

Introduction to Django Easy
A. A Python web framework
B. A desktop operating system
C. A JavaScript testing library
D. A database management system

2 Which programming language is primarily used with Django?

Introduction to Django Easy
A. Java
B. PHP
C. C++
D. Python

3 Which architectural pattern does Django commonly follow?

Introduction to Django Easy
A. Model-View-Template
B. Model-Page-Control
C. Data-Logic-Screen
D. Client-Server-Database

4 Which command is commonly used to install Django with pip?

Installing Python and Django Easy
A. django setup pip
B. python install django
C. pip install django
D. pip create django

5 Which command can display the installed Python version?

Installing Python and Django Easy
A. python --install
B. python --django
C. python --start
D. python --version

6 Which editor feature helps developers run Django commands without leaving the editor?

Setting up project in editor Easy
A. Image preview
B. Spell checker
C. Integrated terminal
D. Color picker

7 What should normally be opened as the workspace folder in a code editor?

Setting up project in editor Easy
A. The browser cache folder
B. The Django project folder
C. The Python download page
D. The operating system folder

8 What does a Django project usually represent?

Projects and Apps overview Easy
A. A single database table definition
B. One HTML page in a browser
C. A Python installation package
D. The complete web application configuration

9 What is a Django app designed to provide?

Projects and Apps overview Easy
A. A Python language compiler
B. A web browser extension
C. A complete operating system
D. A specific reusable feature

10 Can one Django project contain multiple apps?

Projects and Apps overview Easy
A. Yes, but only during testing
B. Yes, it can contain multiple apps
C. No, apps cannot join projects
D. No, it must contain one app

11 Which Django project file contains settings such as installed apps and database configuration?

Project structure Easy
A. settings.py
B. tests.py
C. views.py
D. models.py

12 Which project file usually defines the main URL routes?

Project structure Easy
A. urls.py
B. admin.py
C. apps.py
D. models.py

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

Project structure Easy
A. It lists the application's unit tests
B. It provides a WSGI deployment entry point
C. It stores the project's HTML templates
D. It defines the application's database models

14 Which command creates a Django project named mysite?

Creating your first project Easy
A. django-admin startapp mysite
B. django-admin runserver mysite
C. django-admin startproject mysite
D. django-admin migrate mysite

15 Which command starts Django's development server?

Django-admin and manage.py commands Easy
A. python manage.py collectapp
B. python manage.py startproject
C. python manage.py runserver
D. python manage.py shellserver

16 What is manage.py mainly used for?

Django-admin and manage.py commands Easy
A. Creating tables without Django models
B. Running project-specific Django commands
C. Writing HTML styles for templates
D. Installing the Python programming language

17 Which command applies pending database migrations?

Django-admin and manage.py commands Easy
A. python manage.py testserver
B. python manage.py migrate
C. python manage.py runserver
D. python manage.py startapp

18 Which file in a Django app is commonly used to define database models?

App structures Easy
A. apps.py
B. models.py
C. views.py
D. admin.py

19 Which file in a Django app commonly contains request-handling functions or classes?

App structures Easy
A. tests.py
B. apps.py
C. models.py
D. views.py

20 Which command creates a Django app named blog?

Creating an App Easy
A. python manage.py migrate blog
B. python manage.py startproject blog
C. python manage.py runapp blog
D. python manage.py startapp blog

21 A team must quickly build a database-backed employee portal with authentication and an administrative interface. Why is Django a suitable choice?

Introduction to Django Medium
A. It runs entirely in the browser without a web server
B. It provides an ORM, authentication, and an admin interface
C. It automatically generates a mobile application from Python code
D. It is designed only for static websites that do not use databases or server-side processing

22 Which sequence correctly installs Django in an isolated environment for a new project?

Installing Python and Django Medium
A. Create a Django app, activate manage.py, and install the editor
B. Download Django source files manually, copy them into Python's standard library, and restart the operating system
C. Create a virtual environment, activate it, and run pip install django
D. Install Django globally, create a project, and then create Python

23 A computer has several Python installations. Which command most reliably checks the Django version available to the Python interpreter currently being used?

Installing Python and Django Medium
A. pip create django --version
B. python -m django --version
C. django-admin startproject --version
D. python manage.py install django

24 Django runs correctly from an activated virtual environment, but the editor reports that django imports cannot be resolved. What should be checked first?

Setting up project in editor Medium
A. Every Django package has been copied manually into the editor's extension directory so code completion can detect it
B. The project's templates have been placed inside the settings package
C. The development server has been configured to use a different port number
D. The editor is using the virtual environment's Python interpreter

25 An online store needs separate functionality for products, customer accounts, and payments. Which Django organization is most appropriate?

Projects and Apps overview Medium
A. Three virtual environments placed inside a single app package
B. One app containing three separate manage.py files for each feature
C. One project containing separate products, accounts, and payments apps
D. Three projects containing one shared settings file and one shared server

26 A reviews component may be reused in a bookstore site and a movie site. Which design best supports this goal?

Projects and Apps overview Medium
A. Store all review logic in manage.py so every Django project can execute it without installing an app
B. Combine reviews with every other feature in one large application
C. Keep reviews in a focused app with limited project-specific dependencies
D. Place review models directly in each project's settings.py file

27 After running django-admin startproject portal, which file should be edited to add an installed app and configure a database?

Project structure Medium
A. portal/portal/settings.py
B. portal/portal/asgi.py
C. portal/manage.py
D. portal/portal/urls.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 structure Medium
A. project_package/settings.py
B. project_package/urls.py
C. blog/admin.py
D. blog/models.py

29 A deployment platform requires an ASGI callable for an asynchronous-compatible deployment. Which generated file exposes the appropriate application object?

Project structure Medium
A. manage.py, after rewriting it to create and operate a permanent asynchronous production server
B. settings.py
C. asgi.py
D. 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?

Creating your first project Medium
A. python manage.py startproject config
B. django-admin startproject config .
C. django-admin startproject config
D. django-admin startapp config .

31 Which command starts Django's development server on local port 8080?

Django-admin and manage.py commands Medium
A. python manage.py runserver 8080
B. python manage.py startserver 8080
C. python manage.py runserver, followed by editing settings.py to permanently replace Django's default port
D. django-admin runserver --port 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?

Django-admin and manage.py commands Medium
A. python manage.py collectstatic
B. python manage.py inspectdb
C. python manage.py migrate
D. 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>?

Django-admin and manage.py commands Medium
A. manage.py converts every command into a database migration and applies it before the requested operation begins
B. manage.py automatically points commands to the project's settings
C. manage.py replaces the need for a Python interpreter
D. 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?

Django-admin and manage.py commands Medium
A. python manage.py shell
B. python manage.py migrate
C. python manage.py testserver
D. python manage.py check

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?

App structures Medium
A. views.py
B. admin.py
C. models.py
D. apps.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?

App structures Medium
A. tests.py
B. migrations/__init__.py, where all administration registrations and generated schema changes should be combined
C. admin.py
D. apps.py

37 What is the primary purpose of the migrations directory inside a Django app?

App structures Medium
A. It stores production server configuration for the application
B. It stores HTML templates generated from database records
C. It stores versioned descriptions of database schema changes
D. It stores copies of every model object so the database can be restored automatically whenever the server starts

38 From the directory containing manage.py, which command correctly creates an app named inventory?

Creating an App Medium
A. django-admin createapp inventory
B. python manage.py startproject inventory
C. python inventory manage.py startapp
D. python manage.py startapp 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?

Creating an App Medium
A. Move manage.py into the inventory app directory
B. Add the app to MIDDLEWARE so Django loads its models before processing every incoming HTTP request
C. Rename the app's models.py file to database.py
D. Add inventory or its app configuration to INSTALLED_APPS

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?

Creating an App Medium
A. Run startapp blog again after the development server has started
B. Move the app's views into the project's settings.py module
C. Delete the project URL configuration because Django discovers and exposes all app views automatically
D. Connect a URL pattern to the app's views through the URL configuration

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?

Introduction to Django Hard
A. Model creates responses, Template manages middleware, and View configures database connections
B. Model handles presentation, Template routes requests, and View manages database schemas
C. Model routes URLs, Template validates requests, and View stores persistent application data
D. Model manages data, Template handles presentation, and View coordinates request processing

42 Django was installed successfully with pip install django, but python -m django --version reports No module named django. Which diagnosis is most likely?

Installing Python and Django Hard
A. Python prevents Django imports until DJANGO_SETTINGS_MODULE has been explicitly defined
B. Django cannot be imported until a project has been created with startproject
C. The Django package is available only through django-admin, not as a Python module
D. pip installed Django for a different Python interpreter than the one invoked by python

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?

Installing Python and Django Hard
A. django-admin install Django
B. pip install Django --global
C. python django-admin install
D. python -m pip install Django

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?

Setting up project in editor Hard
A. Configure the editor to use the virtual environment's Python interpreter
B. Copy Django's package directory into the project's source directory
C. Add the Django installation directory to every module's sys.path
D. Replace all Django imports with paths relative to 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?

Projects and Apps overview Hard
A. Use one app containing separate projects for inventory, payment, and reviews
B. Use one project containing separate inventory, payment, and review apps
C. Use one project per model and combine them through a single manage.py file
D. Use three projects containing one shared application package and settings 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?

Projects and Apps overview Hard
A. The app does not contain a second project-level settings.py module
B. The app or its AppConfig is absent from INSTALLED_APPS
C. The app has not been imported manually inside the project's manage.py
D. The app's directory is not listed explicitly in the root URL configuration

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?

Project structure Hard
A. config/urls.py
B. config/asgi.py
C. config/__init__.py
D. 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?

Project structure Hard
A. DJANGO_SETTINGS_MODULE in manage.py from config.settings to core.settings
B. WSGI_APPLICATION in settings.py from config.wsgi to core.urls
C. BASE_DIR in settings.py from config to core
D. 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?

Creating your first project Hard
A. django-admin startapp config .
B. python manage.py startproject config .
C. django-admin startproject . config
D. 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?

Creating your first project Hard
A. Django creates a second entry point named manage_1.py
B. Django refuses to overwrite the conflicting file and reports an error
C. Django silently replaces the existing file with the project template
D. Django moves the existing file into the new config package

51 Why does python manage.py check usually work without a --settings argument, while a directly invoked django-admin check may require settings configuration?

Django-admin and manage.py commands Hard
A. django-admin searches exclusively for settings inside installed application packages
B. manage.py sets the project's default DJANGO_SETTINGS_MODULE before executing commands
C. django-admin supports only commands that do not depend on project settings
D. manage.py embeds all settings directly and never imports a settings module

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?

Django-admin and manage.py commands Hard
A. python manage.py check --settings=config.settings.dev
B. python manage.py check --settings=config/settings/dev.py
C. python manage.py --settings config.settings.dev check
D. python manage.py check --config=config.settings.dev

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?

Django-admin and manage.py commands Hard
A. Run python manage.py startapp to rebuild the application's model registry
B. Run python manage.py collectstatic to register the changed schema
C. Run python manage.py makemigrations to generate a migration first
D. Run python manage.py check to translate the model directly into SQL

54 A development server must accept connections from other machines on the local network using port 9000. Which command requests the required binding?

Django-admin and manage.py commands Hard
A. python manage.py runserver localhost:9000
B. python manage.py runserver --public 9000
C. python manage.py runserver 127.0.0.1:9000
D. python manage.py runserver 0.0.0.0: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?

App structures Hard
A. models.py
B. apps.py
C. admin.py
D. tests.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?

App structures Hard
A. The file is outside the app's migrations Python package
B. The file is missing a URL pattern in the project's urls.py
C. The file is not registered through the app's admin.py module
D. The file is not imported manually from the app's models.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?

Creating an App Hard
A. The generated app lacks its own project-level settings.py
B. The generated app does not yet contain a root manage.py
C. The generated app was not added to INSTALLED_APPS
D. The generated app has not been included in ROOT_URLCONF

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?

Creating an App Hard
A. company.modules.billing.apps.Billing
B. company.modules.billing.apps.BillingConfig
C. company.modules.billing.BillingConfig
D. company.modules.billing.models.BillingConfig

59 A developer wants startapp to populate an already existing directory /srv/project/modules/audit. Which command has the correct argument structure?

Creating an App Hard
A. django-admin startproject audit /srv/project/modules/audit
B. django-admin startapp audit /srv/project/modules/audit
C. django-admin startapp /srv/project/modules/audit audit
D. python manage.py createapp /srv/project/modules/audit 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?

Project structure Hard
A. asgi.py exposes application for WSGI, and wsgi.py exposes application for ASGI
B. manage.py exposes wsgi_application, and urls.py exposes asgi_application
C. settings.py exposes both callables directly through INSTALLED_APPS
D. wsgi.py exposes application for WSGI, and asgi.py exposes application for ASGI