- Home
- Subjects
- Computer Science MCQs
- Django
Django MCQs · Page 2
57 multiple choice questions with answers in Computer Science MCQs.
-
A
To return a list of dictionaries containing specific field values
Correct answer
-
B
To execute a raw SQL query
-
C
To retrieve related objects after the main query is executed
-
D
To perform aggregation functions on querysets
-
A
It removes duplicate rows from query results
-
B
It can be used with the annotate method
-
C
It is only available for PostgreSQL databases
Correct answer
-
D
It can improve query performance
-
A
Adds extra SQL clauses to the query
Correct answer
-
B
Retrieves related objects after the main query is executed
-
C
Performs additional filtering on query results
-
D
Orders query results in ascending or descending order
-
A
default
-
B
choices
-
C
related_model
Correct answer
-
D
verbose_name
-
A
To create multiple objects in a single database query
-
B
To update multiple objects in the database efficiently
Correct answer
-
C
To perform a bulk delete operation using raw SQL
-
D
To retrieve related objects after the main query is executed
-
A
Retrieves related objects after the main query is executed
-
B
Locks selected rows in the database to prevent concurrent updates
Correct answer
-
C
Performs a raw SQL query
-
D
Filters query results based on a condition
-
A
READ COMMITTED
-
B
READ UNCOMMITTED
-
C
REPEATABLE READ
-
D
SERIALIZABLE READ
Correct answer
-
A
Deletes multiple objects from the database
-
B
Creates multiple objects in a single database query
Correct answer
-
C
Updates multiple objects in the database
-
D
Performs a bulk insert operation using raw SQL
-
A
It allows referencing model fields in queries
-
B
It is used to perform mathematical operations in queries
-
C
It can only be used with integer fields
Correct answer
-
D
It helps avoid race conditions in database updates
-
A
To perform aggregation functions on querysets
Correct answer
-
B
To filter query results based on a condition
-
C
To retrieve a single object from the databas
-
D
To order query results in ascending or descending order
-
A
get()
-
B
filter()
Correct answer
-
C
exclude()
-
D
all()
-
A
Using the django.db.connection object
Correct answer
-
B
Using the django.db.models module
-
C
By subclassing the django.db.models.QuerySet class
-
D
By modifying the settings.py file
-
A
Filters query results based on a condition
-
B
Retrieves related objects after the main query is executed
Correct answer
-
C
Orders query results in ascending or descending order
-
D
Performs a raw SQL query
-
A
to_field
-
B
on_delete
-
C
related_name
-
D
unique
Correct answer
-
A
To optimize database queries by reducing the number of queries
Correct answer
-
B
To filter query results based on a condition
-
C
To order query results in ascending or descending order
-
D
To perform a join operation between two tables
-
A
python manage.py makemigrations
-
B
python manage.py migrate
Correct answer
-
C
python manage.py createsuperuser
-
D
python manage.py collectstatic
-
A
Specifies the database column name
-
B
Defines the reverse relationship name
Correct answer
-
C
Specifies the foreign key constraint
-
D
Defines the primary key of the model
-
A
python manage.py migrate
-
B
python manage.py makemigrations
Correct answer
-
C
python manage.py collectstatic
-
D
python manage.py runserver
-
A
MySQL
-
B
SQLite
-
C
MongoDB
Correct answer
-
D
PostgreSQL
-
A
Handling HTTP requests
-
B
Generating HTML templates
-
C
Communicating with the database
Correct answer
-
D
Managing user authentication
-
A
CORSMiddleware
-
B
CrossOriginMiddleware
-
C
django-cors-headers
Correct answer
-
D
CorsMiddleware
-
A
python manage.py run
-
B
python runserver
Correct answer
-
C
django runserver
-
D
run server django
-
A
Collecting static files from all installed apps to a single location
Correct answer
-
B
Collecting media files for deployment
-
C
Collecting dynamic files for caching
-
D
Collecting JavaScript files for optimization
-
A
DjangoScript
-
B
DTL (Django Template Language)
Correct answer
-
C
DjangoHTML
-
D
PyHTML
-
A
python manage.py createsuperuser
Correct answer
-
B
python create_superuser.py
-
C
django-admin superuser
-
D
create superuser django