Olete.in
Articles
Mock Tests
🧪 Django (web framework) MCQ Quiz Hub
Django MCQ Questions
Choose a topic to test your knowledge and improve your Django (web framework) skills
1. Django is a _____________ Python web framework.
low-level
mid-level
high-level
none of the above
2. Django was created in the fall of?
2001
2003
2005
2007
3. Which of the following are Advantages of Django?
Object-Relational Mapping (ORM) Support
Multilingual Support
Administration GUI
Framework Support
4. Django supports the ___________ pattern.
MVP
MVI
MVC
MVZ
5. 5. MVC pattern is based on _______ components.
2
3
4
5
6. MVT Stands for?
Model-View-Template
Model-View-Table
Map-View-Template
Main-View-Template
7. Which commands use to create a project in Django?
$ django-admin createproject project_name
$ django-admin startproject project_name
$ django startproject project_name
$ django createproject project_name
8. Which file is kind of your project local django-admin for interacting with your project via command line?
settings.py
admin.py
models.py
manage.py
9. Which of the following is used If you need to deploy your project over WSGI?
settings.py
wsgi.py
urls.py
.py __init__
10. View response can be the ?
HTML contents
XML documen
404 error
All of the above
11. In Django, views have to be created in the app views.py file.
TRUE
FALSE
Can be true or false
Can not say
12. Render function takes ___________ parameters.
1
2
3
4
13. A variable in django looks like this: _________________.
((variable))
{{variable}}
[[variable]]
[{variable}]
14. How many kinds of HTTP requests there in Django?
2
3
4
5
15. Suppose you want to count the number of books in Django.Which implementation would be fastest?
Template Language Implementation – {{ books | length }}
Python Implementation – len(books)
Database level Implementation – books.count()
None of the above
16. Which of these variables are the settings for django.contib.staticfiles app?
STATIC_URL
STATIC_ROOT
STATICFILES_DIRS
All of the above
17. What are some valid forloop attributes of Django Template System?
forloop.lastitem
forloop.counter
forloop.firstitem
forloop.reverse
18. Django Comments framework is deprecated, since the 1.5 version.
TRUE
FALSE
Can be true or false
Can not say
19. Which of these is not a valid method or approach to perform URL resolution?
Using Template {{ url : }} in template
Using reverse() in View Function
Using get_absolute_url()
None of the above
20. What is the Django shortcut method to more easily render an html response?
render_to_html
render_to_response
response_render
render
21. By using django.contrib.humanize, you can use the following filter in your template to display the number 3 as three.
apnumber.
intcomma
intword
ordinal
22. How do you concatenate two QuerySets into one list?
result = list(query_set_1 | query_set_2)
from itertools import chain result = list(chain(query_set_1, query_set_2))
from django.db.models import Q result = Q(query_set_1) | Q(query_set_1)
result = query_set_1 + query_set_2
23. What is the Django command to start a new app named 'users' in an existing project?
manage.py "“newapp users
manage.py newapp users
manage.py "“startapp users
manage.py startapp users
24. What are the features available in Django web framework?
Admin Interface (CRUD)
Templating
Form handling
All of the above
25. What are the advantages of using Django for web development?
It facilitates you to divide code modules into logical groups to make it flexible to change
It provides auto-generated web admin to make website administration easy
It provides pre-packaged API for common user tasks
All of the above
26. What is the most easiest, fastest, and most stable deployment choice in most cases with Django?
FastCGI
mod_wsgi
SCGI
AJP
27. What happens if MyObject.objects.get() is called with parameters that do not match an existing item in the database?
The Http404 exception is raised
The DatabaseError exception is raised
The MyObject.DoesNotExist exception is raised
The object is created and returned
28. What Commands are used to create a project in Django?
Project
_init_.py
manage.py
All of the above mentioned
29. What is the Django command to view a database schema of an existing (or legacy) database?
manage.py legacydb
django-admin.py schemadump
manage.py inspect
manage.py inspectdb
30. The architecture of Django consists of?
models
Views
Templates
All of the these
31. What does of Django field class types do?
The database column type
The default HTML widget to avail while rendering a form field
The minimal validation requirements used in Django admin
All of the above
32. What is the purpose of settings.py?
To configure settings for the Django project
To configure settings for an app
To sync the database schema
To set the date and time on the server
33. In Django how would you retrieve all the 'User' records from a given database?
User.objects.all()
Users.objects.all()
User.all_records()
User.object.all()
Submit