Django quiz questions

Django interview questions

  • 1.

    Django routes are specified as regular expressions to match URLs. What happens when a URL is matched?

    1. The specified template is rendered, supplying matched arguments as the context.

    2. An 404 HTTP response is returned indicating that the resource not found

    3. The specified view is called and passed the HTTP request and any matched arguments specified in the URL pattern

  • 2.

    How is django.db.models.Model used to define data models for a Django project?

    1. By invoking a factory method of Model.

    2. By creating a new subclass of Model

    3. By passing the model definition as a dictionary parameter

    4. By creating a new instance of Model

  • 3.

    Select all that apply:

    Which of the following tasks can be performed with

    1. Perform database migrations.

    2. Start a test server.

    3. Define new data models.

    4. Create new applications.

  • 4.

    What is the name of the command-line tool that Django provides for managing a newly-created project and its applications?

    1. django-admin


    3. apachectl

    4. pip

  • 5.

    In the Django Template Language, the {% ... %} notation provides for the inclusion of arbitrary Python code, with structures like 'for', 'if', etc.

    1. True

    2. False

  • 6.

    Select all that apply:

    Which of the following features do the automatically generated admin pages provide for a newly created model?

    1. Datatype-appropriate edit fields.

    2. Tracking history of changes to data.

    3. Editing relationally-linked records.

    4. Record creation and deletion.

  • 7.

    What task do migrations automate?

    1. Structural changes to project database tables to reflect changes to data models.

    2. Deployment of project data to production server

    3. Internationalization of site content to reflect local differences in local date and currency formatting conventions 

  • 8.

    Select all that apply:

    What kind of relation is defined between models A and B by invoking ForeignKey(A) in the class definition for model B?

    1. Many to one: each instance of A belongs to an instance of B

    2. One to one: each instance of A corresponds to a unique instance of B.

    3. One to many: each instance of B belongs to an instance of A.


© 2017