All Coursera Quiz Answers

Final Graded Assessment Quiz Answers

In this article i am gone to share Coursera Course: Back-End Developer Capstone by Meta Week 4 | Final Graded Assessment Quiz Answers with you..

Also visit:ย  Security and Testing Quiz Answers

 

Final Graded Assessment Quiz Answers

Question 1)
In which module do you find the generic view classes of the Django REST framework?

  • The rest_framework.views module.
  • The django.views.generic module.
  • The rest_framework.generics module.
  • The rest_framework.viewsets module.

Question 2)
Which of the following options can you use to clone a GitHub repository? Select all that apply.

  • You can use the git clone command in the Git terminal.
  • You can download a GitHub repository as a ZIP file.
  • You can clone a GitHub repository with GitHub’s web interface.
  • You can clone a GitHub repository with the GitHub Desktop app.

Question 3)
Which of the following statements are true about static files in Django? Select all that apply.

  • Image, JavaScript, and CSS files are considered static files in Django.
  • The STATIC_ROOT variable in the project’s settings module is set to the folder in which static files are stored.
  • Static files are stored in a static subfolder inside the app folder.
  • Static files are stored in the static subfolder inside the project’s base directory.

Question 4)
Why is serialization necessary in a DRF API?

  • It validates the user input.
  • It converts model instances to JSON.
  • It creates API endpoints.
  • It maps with the model structure.

Question 5)
Which of the following base endpoints are available when you use Djoser for authenticating a DRF API? Select all that apply.

  • /users/create/
  • /users/me/
  • /users/login/
  • /users/

Question 6)
How are the URL routes for the ViewSet class registered? Select all that apply.

  • With the include() function.
  • With the as_view() method.
  • With the register() function.
  • With the DefaultRouter class.

Question 7)
Where do you enter the authorization token in the Insomnia tool?

  • As Basic Auth in the Auth tab.
  • As a Bearer token in the Auth tab.
  • As JSON text in the Body tab.
  • In the Headers tab.

Question 8)
What is DRF’s browsable API?

  • It’s the home page for the DRF API.
  • It’s a browser plugin for DRF.
  • It’s a desktop application for API testing.
  • It’s a browser-based tool for testing API endpoints.

Question 9)
Which of the following commands are Git commands? Select all that apply.

  • git clone
  • git merge
  • .gitignore
  • git configure

Question 10)
What are the similarities between the project-level urls.py file and the app-level urls.py file? Select all that apply.

  • You can register the viewset URLs in both files.
  • You can register the admin app in both.
  • You can use both of them to set the ROOT_CONF variable in the settings.py file.
  • Both have a list object called urlpatterns defined.

Question 11)
When defining a model, a field in the model that has a unique value for each record of the model is called a what?

  • Primary Key
  • Relationship
  • Foreign Key
  • CharField

Question 12)
What command can be used to see the SQL commands that have been executed as a result of running model migrations in Django?

  • manage.py showmigrations
  • manage.py migrate
  • manage.py sqlmigrate
  • manage.py makemigrations

Question 13)
Once Python is installed and a virtual environment is set up, what is the command to install Django into the currently active environment?

  • python3 install django
  • django-admin install django
  • pip3 django-install
  • pip3 install django

Question 14)
When using the ORM in Django, the get function can be used to retrieve a specific record from the database. This is equivalent to what SQL command?

  • DELETE
  • SELECT
  • FROM
  • CASCADE

Question 15)
When a field is defined on a Django form, which property is defined by default?

  • initial=โ€Field Nameโ€
  • label=โ€Field Nameโ€
  • required=True
  • required=False

Question 16)
What pattern is used for permissions in Django Admin?

  • <app>.<action>.<model>
  • <model>.<action>
  • <app>.<action_model>
  • <app>.<model>.<action>

Question 17)
In addition to the GET method calls, _____ calls also do not typically have a request body to send to the API endpoint.

  • PATCH
  • DELETE
  • POST
  • PUT

Question 18)
On an existing HTML page, all <h2> tags on the page need to be updated with content retrieved from a database. What Javascript code would be used to select all <h2> tags?

  • document.get(โ€˜h2)
  • document.querySelector(โ€˜h2โ€™)
  • document.querySelectorAll(โ€˜h2โ€™)
  • page.select(โ€˜h2โ€™)

Question 19)
What SQL command would be used if a new column needed to be added to an existing table?

  • ALTER
  • CREATE
  • DROP
  • SELECT

Question 20)
In this for loop, assuming favorites is a Python list, what does idx represent?

for idx, item in favorites: print(item)
  • The current item
  • The max number of iterations
  • The current index
  • The starting iteration number

Question 21)
If an object is created inside of a function in Javascript, it is a member of which scope?

  • block
  • class
  • local
  • global

Question 22)
Which Django module contains the APIs for the HttpRequest and HttpResponse object?

  • django.web
  • django.api
  • django.http
  • django.request and django.response

Question 23)
What special character marks the end of a regular expression?

  • / (forward slash)
  • * (asterisk or star)
  • ^ (caret)
  • $ (dollar sign)

Question 24)
If the web server is taking a long time to respond to a request and seems to have failed, an error in which range may be displayed?

  • 200-299
  • 500-599
  • 400-499
  • 100-199

Question 25)
When importing the math module in an application, the following import statement is used:

import math as m

What does m represent?

  • view
  • alias
  • model
  • interpreter

Question 26)
What is the first step in test-driven development?

  • Determine the Python modules needed for the application.
  • Write test cases with some functionality in mind.
  • Write code to make tests pass.
  • Refactor code that isnโ€™t passing tests.

Question 27)
When creating a superuser in the Django shell, which of the following user details are mandatory? Select all that apply.

  • Username
  • Email
  • Password
  • Permissions

Question 28)
Where does a client specify the data type (like JSON or XML) it would like to receive when asking for data?

  • request payload
  • request headers
  • response headers
  • URL path

Question 29)
In a CSS grid layout, where do a column and row intersect?

  • block
  • cell
  • gutter
  • container

Question 30)
When an algorithm always runs under the same time and space complexity, regardless of its size, this is called what?

  • linear time
  • logarithmic time
  • quadratic time
  • constant time

 

Question 31)
Which of the following is an essential requirement to serve static files in Django? Select all that apply.

  • You must define the /static route in the URLConf.
  • The STATIC_ROOT variable must be set to the path of the static folder in the settings.py file.
  • The {% load static %} tag must be declared in a template.
  • You must include the staticfiles app in the INSTALLED_APPS list.

Question 32)
True or False: A ModelSerializer maps closely to model definitions in a Django app.

  • True
  • False

Question 33)
To use the Djoser library for token authentication, you need to complete which of the following tasks? Select all that apply.

  • You must add the code djoser in the INSTALLED_APPS list.
  • You must install the code djoser.urls in the URL configuration.
  • You must install Djoser with pip.
  • You must install the package djangorestframework_simplejwt with pip.

Question 34)
How can you obtain an authorization token for a user in the DRF API? Select all that apply.

  • Using the djoser endpoint /token/create/.
  • By invoking the obtain_auth_token view.
  • Using the djoser endpoint /token/login/.
  • Using Django’s Admin interface.

Question 35)
To configure Django for MySQL, which of the following properties is not required in the DATABASES section of the settings.py file? Select all that apply.

  • PASSWORD
    Storage engine
  • USER
  • HOST

Question 36)
A model in Django represents what structure in the database?

  • table
  • relationship
  • primary key
  • foreign key

Question 37)
What command in Django takes the built models and applies them to the database to create the appropriate structures?

  • manage.py sqlmigrate
  • manage.py migrate
  • manage.py makemigrations
  • manage.py showmigrations

Question 38)
Which function in the QuerySet API is used to provide the same functionality as the LIMIT or WHERE clauses in SQL?

  • return
  • search
  • join
  • filter

Question 39)
To help users with completing a form, some text can be defined to provide guidance on how to complete a specific field. What property is used to define this?

  • required
  • initial
  • help_text
  • label

Question 40)
Where can customer permissions be enforced that are created in model classes? Select all that apply.

  • models
  • views
  • URL patterns
  • templates

Question 41)
One of the most common things to use Javascript for when building a dynamic front end is manipulating the _____, which represents the structure of the information on the page.

  • document object model
  • form
  • container
  • Django model

Question 42)
When creating a match statement, _____ statements are used inside of it to define the various conditions to check for.

  • switch
  • if
  • else
  • case

Question 43)
If a variable is shared across an entire Javascript file and can be used in any function or other part of the code, what scope is it part of?

  • block
  • global
  • local
  • function

Question 44)
A request is made to an API endpoint. The URL contains information needed to determine some business logic on the back end. What property of the request object can be used to get this information?

  • user
  • path
  • COOKIES
  • FILES

Question 45)
What special character matches zero or more characters while using Regular Expressions?

  • + (plus)
  • # (hash)
  • * (asterisk or star)
  • ^ (caret)

Question 46)
Which HTTP status code indicates that a user must login before trying to process the request?

  • 401
  • 301
  • 403
  • 504

Question 47)
Which of the following are scopes in Python? Select all that apply.

  • Built-in
  • Enclosed
  • Function
  • Block

Question 48)
What piece of code is used to register a model once the model has been created in the admin.py file?

  • model.site.register()
  • site.register.model()
  • django.register()
  • admin.site.register()

Question 49)
When developing an upgraded version of an existing API, why should versioning be used?

  • To keep the response structure the same.
  • Itโ€™s easy to manage multiple versions of an API.
  • New versions of the API will only be available to new applications.
  • So existing code using the API is still functional.

Question 50)
For a given <div> tag and <p> tag, which of the following has the correct syntax for an adjacent sibling combinator?

  • div ~ p
  • div p
  • div > p
  • div + p

Question 51)
Which of the following types are generic views defined in the Django REST Framework? Select all that apply.

  • ListCreateView
  • RetrieveUpdateView
  • TemplateView
  • api_view

Question 52)
What is the difference between the commands git init and git clone?

  • The command git init initializes a blank local repository. The command git clone creates a new local directory from the remote GitHub repository.
  • You need to run the command gitinit before git clone.
  • There is no difference between the two commands.
  • You use git clone to replicate the local repository on Github.

Question 53)
Complete the following sentence. In Djoser, the endpoint to visit for generating a token for authentication is _________________________.

  • /token/new/
  • /token/login/
  • /token/create/
  • /tokens/

Question 54)
How does a ViewSet handle the HTTP requests? Select all that apply.

  • You can write a separate ViewSet class for each type of HTTP request.
  • The ViewSet internally creates URL routes for each HTTP call.
  • You may implement methods like create()and list() to handle request methods such as POST and GET.
  • You provide separate methods get() or post() inside the class.

Question 55)
True or false: You run unit tests in Insomnia.

  • True
  • False

Question 56)
True or False: TokenAuthentication is more secure than SessionAuthentication.

  • True
  • False

Question 57)
How can you check which git branch you are currently checked out to? Select all that apply.

  • By using the git checkout command.
  • By using the git list command.
  • By using the git status command.
  • By using the git branch command.

Question 58)
True or False: A DRF API is different from a Django app.

  • True
  • False

Question 59)
When building a model in Django, first we create the model and then run manage.py makemigrations. What does this do?

  • Creates a new database and readies it to receive data.
  • Creates the model as a table in SQL.
  • Shows all of the migrations that have been created.
  • Creates the migration scripts to be run.

Question 60)
When creating a new Django application inside of a project, what is the appropriate command?

  • python manage.py installapp <app name>
  • python manage.py startapp <app name>
  • python manage.py runapp <app name>
  • python manage.py createapp <app name>

Question 61)
Which of the following are valid field types in Django when defining a form? Select all that apply.

  • CharField
  • SelectField
  • PrivateField
  • EmailField

Question 62)
What is the modern, native API used in Javascript used to interact with APIs?

  • fetch
  • jQuery
  • Axios
  • XMLHttpRequest

Question 63)
On an existing HTML page, all <h2> tags on the page need to be updated with content retrieved from a database. What Javascript code would be used to select all <h2> tags?

  • document.querySelectorAll(โ€˜h2โ€™)
  • page.select(โ€˜h2โ€™)
  • document.get(โ€˜h2)
  • document.querySelector(โ€˜h2โ€™)

Question 64)
True or False: When using let in Javascript, the defined variable can be used in the application before it is declared.

  • True
  • False

Question 65)
When a request is made to a Django-based web application, what attribute of the HTTP request would tell the application which HTTP verb the request is using?

  • method
  • user
  • cookies
  • has_key()

Question 66)
If a module in Python already exists and it is needed to be used in a new program, which keyword can be used to add it to our program in a way that the existing code can be used?

  • import
  • def
  • export
  • from

Question 67)
What prefix should be used when creating test cases using PyTest?

  • test_
  • unittest_
  • pytest-
  • test-

Question 68)
Which response type from an API would result in a data structure of key-value pairs that could be used by the requestor?

  • Javascript
  • JSON
  • XML
  • HTML

Question 69)
Calculate the specificity of the following selector:

ul#alpha #li.visited
  • 211
  • 112
  • 103
  • 13

Question 70)
When code is reworked in an application to improve the time or space complexity, this is called what?

  • DRY principle
  • refactoring
  • commenting
  • Code review

Question 71)
Complete the following sentence. The APIView class in the Django REST framework acts as ____________________________.

  • a base class for class-based views
  • an API policy decorator for function-based views
  • a decorator with HTTP method parameters for function-based views
  • a base class for generic views

Question 72)
Which of the following statements are true? Select all that apply.

  • The git pull command updates your current local working branch with all new commits.
  • The git fetch command downloads all history from the remote tracking branches.
  • The git merge command combines the remote tracking branch into the current local branch.
  • The git add command updates the remote repository.

Question 73)
When models are created and registered in Django and all the migrations are properly run, how are initial permissions created in Django Admin?

  • A โ€œstaffโ€ user must login to Django Admin and create them.
  • An additional command must be run from the command line.
  • The model must specifically define the permissions.
  • They are create automatically.

Question 74)
Which Javascript selector returns the first instance of a provided tag type from the DOM?

  • querySelectorAll
  • getTag
  • querySelector
  • tagSelector

Question 75)
What SQL command would be used to remove all records from a table while leaving the structure of the table intact?

  • ALTER
  • DROP
  • UPDATE
  • TRUNCATE

Question 76)
What part of a conditional statement is only executed when no other conditions in the statement are met?

  • except
  • else
  • elif
  • if

Question 77)
The process of writing a Python application by first writing tests, and then writing code to ensure that the tests pass is called what?

  • continuous deployment
  • test-driven development
  • Agile development
  • continuous integration

Question 78)
Which template tag is necessary to serve the static files in the template?

  • {% load static %}
  • {% load “/static ” %}
  • {% static %}
  • {% include static %}

Question 79)
How can you obtain a token with DRF’s browsable API?

  • You cannot obtain a token with the browsable API.
  • You must install Djoser, use a POST request, and visit the endpoint /users/.
  • You must activate TokenAuthentication in the settings.py file and visit the obtain_auth_token.
  • You must install Djoser, use a POST request, and visit the endpoint /users/create/.

Question 80)
This is the most common language used in interacting with databases.

  • HTML
  • SQL
  • Javascript
  • Python

Question 81)
What tool is used to find patterns in a string, and can be used in Django to define dynamic URLs to send information to the proper view function?

  • objects
  • models
  • templates
  • regular expressions

Question 82)
How do you declare a Serializer class to serialize the instances of a Django model?

  • You define the attributes of the Serializer class to match with the model fields.
  • You define the Serializer class subclassing the Model.
  • You extend the ModelSerializer class and set the model property of the inner Meta class to the desired Django model.
  • You set the model attribute of the Serializerclass to the desired Django model.

Question 83)
When using Javascript to make a PUT call to an API, what method needs to be used with our JSON data before sending it to the endpoint

  • JSON.toString()
  • JSON.convert()
  • JSON.stringify()
  • document.json()

Question 84)
In the case of status codes inside the HTTP responses, the status codes between 200-299 represent which of the following type of message?

  • Server error
  • Redirection
  • Successful
  • Informational

Question 85)
True or False: Using Git, you can push a local branch to a remote branch.

  • True
  • False

Question 86)
True or false: When using the ModelViewSet, you serialize the queryset with its serializer_class attribute.

  • True
  • False

Question 87)
When defining a model, sometimes there is a field in the model that is used as a unique identifier in another model, used to create relationships between them. This is called what?

  • CharField
  • Relationship
  • Foreign Key
  • Primary Key

Question 88)
When the ORM is used in Django to run a query against the database, what format are the results returned in?

  • HTML
  • XML
  • JSON
  • QuerySet

Question 89)
Which package provides Django’s authentication and authorization system?

  • django.contrib.admin
  • django.apps
  • django.core.wsgi
  • django.contrib.auth

Question 90)
To set up a Django project in the current folder, what is the proper command?

  • python manage.py runserver
  • django-admin startproject <project name>
  • python -m venv <project name>
  • pip3 install django <project name>

Question 91)
On an existing HTML page, all <h2> tags on the page need to be updated with content retrieved from a database. What Javascript code would be used to select all <h2> tags?

  • page.select(โ€˜h2โ€™)
  • document.querySelectorAll(โ€˜h2โ€™)
  • document.get(โ€˜h2)
  • document.querySelector(โ€˜h2โ€™)