wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Django Framework Quiz

Total questions: 15

Worksheet time: 11mins

Name
Class
Date
1.

What is the primary purpose of Django in web development?

a)

Designing user interfaces

b)

Providing a framework for server-side web development

c)

Managing databases

d)

Automating system administration tasks

2.

How does Django help in improving the security of web applications?

a)

By providing built-in security features like CSRF and XSS protection

b)

By including a firewall

c)

By offering antivirus protection

d)

By encrypting all traffic by default

3.

What is the function of Django's ORM (Object-Relational Mapping)?

a)

To generate HTML templates

b)

To handle user authentication

c)

To interact with databases using Python objects

d)

To manage static files

4.

Which command is used to start a new Django project?

a)

django-admin startproject <projectname>

b)

django startproject <projectname>

c)

python startproject <projectname>

d)

django-admin createproject <projectname>

5.

What file is used to configure the settings of a Django project?

6.

In Django, what is the purpose of the urls.py file?

a)

To define the database schema

b)

To handle user authentication

c)

To map URL patterns to views

d)

To manage static and media files

7.

What is a Django model?

a)

A representation of the HTML structure

b)

A representation of a database table

c)

A set of CSS styles

d)

A collection of JavaScript functions

8.

Which command is used to apply migrations in Django?

a)

django-admin makemigrations

b)

python manage.py makemigrations

c)

python manage.py migrate

d)

python manage.py apply

9.

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

a)

To define URL patterns

b)

To initialize a Python package

c)

To handle database migrations

d)

To configure settings

10.

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

a)

To handle URL routing

b)

To manage asynchronous operations

c)

To define the WSGI application for the project

d)

To set up the database schema

11.

Where should static files (e.g., CSS, JavaScript) be placed in a Django project?

a)

In the templates folder

b)

In the static folder

c)

In the media folder

d)

In the config folder

12.

What is the purpose of the templates folder in a Django project?

a)

To store static files

b)

To define database models

c)

To contain HTML templates used to render views

d)

To manage form submissions

13.

How can you organize static files within an individual Django app?

a)

By placing them in the app_name/templates directory

b)

By placing them in the app_name/static directory

c)

By placing them in the root static directory

d)

By placing them in the app_name/media directory

14.

What setting in settings.py specifies the URL for serving static files in development?

a)

STATIC_URL

b)

STATICFILES_DIRS

c)

STATIC_ROOT

d)

STATICFILES_STORAGE

15.

How can you load and use a static file in a Django template?

a)

{% static "filename" %}

b)

<img src="static/filename" />

c)

{% load_static "filename" %}

d)

<link rel="stylesheet" href="static/filename" />