Complete the following sentence. The
APIView
class in the Django REST framework acts as ____________________________.an API policy decorator for function-based views
a base class for generic views
a base class for class-based views
a decorator with HTTP method parameters for function-based views
Which of the following options can you use to clone a GitHub repository? Select all that apply.
You can clone a GitHub repository with the GitHub Desktop app.
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.
Which template tag is necessary to serve the static files in the template?
{% load "/static " %}
{% load static %}
{% static %}
{% include static %}
True or False: A
ModelSerializer
maps closely to model definitions in a Django app.True
False
Which of the following base endpoints are available when you use Djoser for authenticating a DRF API? Select all that apply.
/users/me/
/users/create/
/users/login/
/users/
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.You may implement methods like
create()
andlist()
to handle request methods such asPOST
andGET
.The
ViewSet
internally creates URL routes for each HTTP call.You provide separate methods
get()
orpost()
inside the class.
How can you obtain an authorization token for a user in the DRF API? Select all that apply.
Using the
djoser
endpoint/token/login/
.Using Django's Admin interface.
By invoking the
obtain_auth_token
view.Using the
djoser
endpoint/token/create/
.
True or False:
TokenAuthentication
is more secure thanSessionAuthentication
.True
False
How can you check which git branch you are currently checked out to? Select all that apply.
By using the
git branch
command.By using the
git checkout
command.By using the
git status
command.By using the
git list
command.
What are the similarities between the project-level
urls.py
file and the app-levelurls.py
file? Select all that apply.You can register the
viewset
URLs in both files.Both have a list object called
urlpatterns
defined.You can register the admin app in both.
You can use both of them to set the
ROOT_CONF
variable in thesettings.py
file.
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
Foreign Key
Primary Key
Relationship
When building a model in Django, first we create the model and then run
manage.py
makemigrations
. What does this do?Creates the model as a table in SQL.
Creates a new database and readies it to receive data.
Creates the migration scripts to be run.
Shows all of the migrations that have been created.
Once Python is installed and a virtual environment is set up, what is the command to install Django into the currently active environment?
pip3 django-install
django-admin install django
python3 install django
pip3 install django
When the ORM is used in Django to run a query against the database, what format are the results returned in?
XML
JSON
QuerySet
HTML
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?
label
help_text
required
initial
When models are created and registered in Django and all the migrations are properly run, how are initial permissions created in Django Admin?
The model must specifically define the permissions.
An additional command must be run from the command line.
A “staff” user must login to Django Admin and create them.
They are create automatically.
What is the modern, native API used in Javascript used to interact with APIs?
Axios
XMLHttpRequest
jQuery
fetch
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)
page.select(‘h2’)
document.querySelector(‘h2’)
document.querySelectorAll(‘h2’)
What SQL command would be used to remove all records from a table while leaving the structure of the table intact?
DROP
TRUNCATE
ALTER
UPDATE
What part of a conditional statement is only executed when no other conditions in the statement are met?
else
if
except
elif
If an object is created inside of a function in Javascript, it is a member of which scope?
global
block
class
local
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?
path
FILES
COOKIES
user
What special character matches zero or more characters while using Regular Expressions?
*
(asterisk or star)#
(hash)^
(caret)+
(plus)
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?
100-199
500-599
400-499
200-299
Which of the following are scopes in Python? Select all that apply.
Block
Enclosed
Built-in
Function
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
Agile development
continuous integration
test-driven development
Which package provides Django's authentication and authorization system?
django.contrib.auth
django.apps
django.core.wsgi
django.contrib.admin
Where does a client specify the data type (like JSON or XML) it would like to receive when asking for data?
response headers
request payload
request headers
URL path
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
What type of algorithm grows depending on the size of the input?
exponential time algorithm
logarithmic time algorithm
constant time algorithm
linear time algorithm