Final graded quiz: Django Web Framework

Final graded quiz: Django Web Framework

  1. Which one of the following network configurations does NOT need to be provided explicitly to the web framework to establish a connection with an external database such as MySQL?

    • Port

    • Database name

    • Database version

    • Address

  2. Which of the following tags in the Django template language are relevant to the Template Inheritance? Select all that apply.

    • csrf_token

    • extends

    • static

    • include

  3. If you run the code below, what will the generated output be for the specified view on the web page?

     def home(request): 
     ...
     return HttpResponse("Hello") 
     return HttpResponse("World")
    
    • Hello

    • Hello World

    • World

  4. Which of the following are the advantages of using Function-based views?

    • Code can be extended to include more functionalities.

    • Code reusability

    • Use of decorators

    • Explicit code flow

  5. Which one of the following is NOT a command that can be executed in the command line using the script manage.py?

    • shell

    • showmigrations

    • settings

    • runserver

  6. When performing migrations, what is the expected output produced if you run the following query on the command line?

     python3 manage.py sqlmigrate
    
    • It will show the operations and dependencies performed in migrations.

    • It will show the SQL queries run during the migrations.

    • It will run the SQL queries required to perform migrations.

  7. Complete the following sentence. Form validation must ideally occur on ________________

    • neither the client nor server side, but in the middleware of the web framework.

    • both the client-side and server-side.

    • the server-side.

    • the client-side.

  8. What special character matches zero or more characters while using Regular Expressions?

    • ^ (caret)

    • # (hash)

    • * (star)

    • + (plus)

  9. Complete the following sentence. Variables are passed from the view to the template by passing them inside the render() function in the form of _______ objects.

    • tuple

    • list

    • dictionary

    • dynamic

  10. For the declaration of class MenuTestCase created for testing, what will be the parameter passed inside it to implement the unittest package of Python? For example:

    • TestUnit

    • TestCase

    • UnitCase

    • UnitTest