---Advertisement---
Django Microservices Object-Relational Mapper

Django Object-Relational Mapper Interview Question-Answer

By smart_answer13

Published on:

---Advertisement---

Q.1 Choose the correct option to create an app ‘myapp’.

       A. python manage.py start myapp

       B. python manage.py startproject myapp

       C. python manage.py startapp myapp

       D. python manage.py myapp

Ans : python manage.py startapp myapp


Q.2 A Django app will contain _____.

       A. views.py

       B. tests.py

       C. apps.py

       D. models.py

       E. All the options

Ans : All the options


Q.3 Choose the correct option to create a project myworld using the Django-admin command.

       A. $ django-admin createproject myworld

       B. $ django-admin create myworld

       C. $ django-admin startproject myworld

       D. $ django-admin start myworld

Ans : $ django-admin startproject myworld


Q.4 Select the incorrect statement.

       A. A project can have multiple apps

       B. A project can have a single application

       C. One app can be in multiple projects

       D. None of the options

Ans : A project can have multiple apps


Q.5 Which setting can be used while adding a new Django app?

       A. DYNAMIC_APPS

       B. ADD_APPS

       C. INSTALLED_APPS

       D. CREATE_APPS

Ans : INSTALLED_APPS


Q.6 Select the incorrect statement: Django ORM.

       A. Auto generates primary keys

       B. Efficient for simple and medium databases

       C. Autocommit transactions

       D. Supports SQLite only

Ans : Supports SQLite only


Q.7 Object-relational Mapper (ORM) is a code library to automate the data transfer between _______.

       A. Databases and Objects

       B. Objects and Arrays

       C. Databases and Arrays

       D. Relational DB and Objects

Ans : Relational DB and Objects


Q.8 Identify the ORM most used for Flask Web Framework.

       A. peewee

       B. SQLAlchemy

       C. Hibernate

       D. Django’s ORM

Ans : SQLAlchemy


Q.9 What is/are applicable for Django ORM?

       A. Shifting complexity from the database into the application code

       B. Potential for reduced performance

       C. Impedance mismatch

       D. All the options

Ans : All the options


Q.10 id- is the auto assigned primary key by Django with the datatype.

       A. models.FloatField()

       B. models.TextField()

       C. models.AutoField()

       D. models.IntegerField()

Ans : models.AutoField()


Q.11 What are the different ways of connecting multiple models relationship?

       A. One-to-one

       B. Many-to-one

       C. Many-to-many

       D. All the options

Ans : All the options


Q.12 To rename the Manager for a given class, what attribute type can be used in models.Manager() on that model?

       A. objects

       B. Customer

       C. filter

       D. class

Ans : class


Q.13 A Django model is a Python class that subclasses _________.

       A. djangodb.models.Model

       B. django.db.model.Models

       C. djangodb.model.Models

       D. django.db.models.Model

Ans : django.db.models.Model


Q.14 When choosing field names for the model, it should not conflict with the model API. The field name should not be _________.

       A. clean

       B. clean, save and delete

       C. save and delete

       D. delete

       E. save

       F. clean and save

Ans : clean, save and delete


Q.15 What exception is an attribute of each model class?

       A. ClassDoesnotExist

       B. AttributeDoesnotExist

       C. ObjectDoesnotExist

       D. DoesnotExist

Ans : DoesnotExist


Q.16 What can be used to provide custom model validation and to modify attributes on the model like changing the value on a field upon a conditional check?

       A. Model.full_clean()

       B. Model.clean()

       C. Model.validate_unique(exclude=None)

       D. Model.clean_fields(exclude=None)

Ans : Model.clean()


Q.17 What can be used to validate all model fields, if any field is to be exempted from validation? Provide it in the exclude parameter.

       A. Model.clean()

       B. Model.clean_fields(exclude=None)

       C. Model.full_clean()

       D. Model.validate_unique(exclude=None)

Ans : Model.clean_fields(exclude=None)


Q.18 What can be used to validate all unique constraints on the model instead of individual field values?

       A. Model.clean()

       B. Model.clean_fields(exclude=None)

       C. Model.full_clean()

       D. Model.validate_unique(exclude=None)

Ans : Model.validate_unique(exclude=None)


Q.19 When an object is saved, Django _____________.

       A. emits a pre save signal

       B. emit a post save signal

       C. prepares data for the database

       D. preprocesses the data

       E. inserts data into database

       F. all the options

Ans : all the options


Q.20 Select the incorrect statement about A QuerySet.

       A. Can have filters to obtain different query results

       B. Is a collection of database objects

       C. Incomparable to a database select operation

       D. Can be operated on a model

Ans : Incomparable to a database select operation


Q.21 Select the incorrect statement: QuerySet API are classified as _________.

       A. Methods that return new QuerySets

       B. Field Lookups

       C. Methods that do not return QuerySets

       D. Methods that return new querysets’ AND ‘field lookups’ AND ‘aggregation functions’

       E. Aggregation funcions

       F. all the options

Ans : all the options


Q.22 Django is loaded with a database-abstraction API to ______.

       A. update and delete objects

       B. create objects

       C. retrieve objects

       D. all the options

Ans : all the options


Q.23 Data migrations _________.

       A. alter data

       B. use RunPython operation that takes a callable as argument

       C. custom written unlike schema migrations

       D. all the options

Ans : all the options


Q.24 Table names in databases are created by default with app_classname.

       A. True

       B. False

Ans : True


Q.25 exclude(**kwargs) – Returns QuerySet containing objects matching given lookup parameters.

       A. True

       B. False

Ans : False


smart_answer13

---Advertisement---

Related Post

Zipkin-Jaeger Interview Question-Answer

Q.1 Which is responsible for sending spans to storage?        A. Transport        B. Collector        C. Component        D. ...

Weaveworks Interview Question-Answer

Q.1 Which of the following features offered by WeaveClouds?        A. Observability        B. VCS integration        C. none of the mentioned ...

Vaadin Unplugged Interview Question-Answer

Q.1 Which of the Programming Model is not supported by Vaadin?        A. Browser        B. Client Side        C. Server Side ...

Spring Boot Framework Interview Question-Answer Part – 2

Q.1 The annotation used to import additional configuration classes is ___________.        A. @Import        B. @Include        C. @EnableImport     ...

Leave a Comment