MCQs | Django (web framework)/Django MCQ Questions Sample Test,Sample questions

Question:
Django was created in the fall of?

1.2001

2.2003

3.2005

4.2007


Question:
How many kinds of HTTP requests there in Django?

1.2

2.3

3.4

4.5


Question:
In Django how would you retrieve all the 'User' records from a given database?

1.User.objects.all()

2.Users.objects.all()

3.User.all_records()

4.User.object.all()


Question:
Suppose you want to count the number of books in Django.Which implementation would be fastest?

1.Template Language Implementation – {{ books | length }}

2.Python Implementation – len(books)

3.Database level Implementation – books.count()

4.None of the above


Question:
The architecture of Django consists of?

1.models

2.Views

3.Templates

4. All of the these


Question:
What happens if MyObject.objects.get() is called with parameters that do not match an existing item in the database?

1.The Http404 exception is raised

2.The DatabaseError exception is raised

3.The MyObject.DoesNotExist exception is raised

4.The object is created and returned


Question:
Which of these variables are the settings for django.contib.staticfiles app?

1.STATIC_URL

2.STATIC_ROOT

3.STATICFILES_DIRS

4.All of the above


Question:
5. MVC pattern is based on _______ components.

1.2

2.3

3.4

4.5


Question:
A variable in django looks like this: _________________.

1.((variable))

2.{{variable}}

3. [[variable]]

4. [{variable}]


Question:
By using django.contrib.humanize, you can use the following filter in your template to display the number 3 as three.

1.apnumber.

2.intcomma

3.intword

4.ordinal


Question:
Django Comments framework is deprecated, since the 1.5 version.

1.TRUE

2.FALSE

3.Can be true or false

4.Can not say


Question:
Django is a _____________ Python web framework.

1.low-level

2.mid-level

3.high-level

4.none of the above


Question:
Django supports the ___________ pattern.

1.MVP

2.MVI

3.MVC

4.MVZ


Question:
How do you concatenate two QuerySets into one list?

1. result = list(query_set_1 | query_set_2)

2.from itertools import chain result = list(chain(query_set_1, query_set_2))

3. from django.db.models import Q result = Q(query_set_1) | Q(query_set_1)

4.result = query_set_1 + query_set_2


Question:
In Django, views have to be created in the app views.py file.

1.TRUE

2.FALSE

3.Can be true or false

4.Can not say


Question:
MVT Stands for?

1.Model-View-Template

2.Model-View-Table

3.Map-View-Template

4.Main-View-Template


Question:
Render function takes ___________ parameters.

1.1

2.2

3.3

4.4


Question:
View response can be the ?

1.HTML contents

2.XML documen

3.404 error

4.All of the above


Question:
What are some valid forloop attributes of Django Template System?

1.forloop.lastitem

2.forloop.counter

3.forloop.firstitem

4.forloop.reverse


Question:
What are the advantages of using Django for web development?

1.It facilitates you to divide code modules into logical groups to make it flexible to change

2.It provides auto-generated web admin to make website administration easy

3.It provides pre-packaged API for common user tasks

4. All of the above


Question:
What are the features available in Django web framework?

1.Admin Interface (CRUD)

2.Templating

3.Form handling

4. All of the above


Question:
What Commands are used to create a project in Django?

1.Project

2._init_.py

3.manage.py

4.All of the above mentioned


Question:
What does of Django field class types do?

1.The database column type

2.The default HTML widget to avail while rendering a form field

3.The minimal validation requirements used in Django admin

4.All of the above


Question:
What is the Django command to start a new app named 'users' in an existing project?

1.manage.py "“newapp users

2.manage.py newapp users

3.manage.py "“startapp users

4.manage.py startapp users


Question:
What is the Django command to view a database schema of an existing (or legacy) database?

1.manage.py legacydb

2.django-admin.py schemadump

3.manage.py inspect

4.manage.py inspectdb


Question:
What is the Django shortcut method to more easily render an html response?

1.render_to_html

2. render_to_response

3. response_render

4.render


Question:
What is the most easiest, fastest, and most stable deployment choice in most cases with Django?

1. FastCGI

2.mod_wsgi

3.SCGI

4.AJP


Question:
What is the purpose of settings.py?

1. To configure settings for the Django project

2.To configure settings for an app

3. To sync the database schema

4.To set the date and time on the server


Question:
Which commands use to create a project in Django?

1. $ django-admin createproject project_name

2. $ django-admin startproject project_name

3.$ django startproject project_name

4. $ django createproject project_name


Question:
Which file is kind of your project local django-admin for interacting with your project via command line?

1. settings.py

2.admin.py

3.models.py

4. manage.py


Question:
Which of the following are Advantages of Django?

1.Object-Relational Mapping (ORM) Support

2.Multilingual Support

3.Administration GUI

4.Framework Support


Question:
Which of the following is used If you need to deploy your project over WSGI?

1.settings.py

2.wsgi.py

3. urls.py

4..py __init__


Question:
Which of these is not a valid method or approach to perform URL resolution?

1.Using Template {{ url : }} in template

2. Using reverse() in View Function

3.Using get_absolute_url()

4.None of the above


More MCQS

  1. Django MCQ Questions
Search