In this article i am gone to share Django Web Framework by Meta | Final graded quiz: Django Web Framework Quiz Answers with you..
Enroll Link: Django Web Framework
Final graded quiz: Django Web Framework Quiz Answers
Question 1)
When you launch the development server, the default URL loads a Congratulations! page, with a rocket taking off. This page has a reference to the DEBUG option set to which value?
- Unset
- Production
- False
- True
Question 2)
Suppose you create the following view function.
def home(): return HttpResponse("Hello World")
What will the outcome be if a request object is not passed to the view function?
- Django will throw an error
- The code will execute, but no view is generated on the webpage
- The view will still be rendered
Question 3)
The application layer in the MVC (not MVT used in Django) framework is represented by:
- M
- V
- C
Question 4)
When creating a form using ModelForm, you must register both the Form and the Model inside the admin.py file.
- True
- False
Question 5)
Suppose you are creating a superuser in the Django shell. Which of the following user details are mandatory? Select all that apply.
- Username
- Group name
- Permissions
- Password
Question 6)
Complete the following sentence: Jinja2 is a type of __________
- an alternative protocol for web communication.
- template Engine.
- functionality to enable template inheritance.
- security tag added inside the templates.
Question 7)
Which of the following are the built-in path converters used for URL configuration in Django? Select all that apply.
- boolean
- slug
- float
- path
- str
Question 8)
A Staff user is not allowed to access the admin interface but is authorized by default to change permissions to create, read, update and delete.
- True
- False
Question 9)
In the case of status codes inside the HTTP responses, the status codes between 200-299 represent which of the following type of message?
- Informational
- Server error
- Successful
- Redirection
Question 10)
What are the advantages of using the built-in SQLite database with Django?
- Scalability
- Suitable for small, low-risk projects
- Security and authentication
- Rapid prototyping
Question 2)
Which of the following tags in the Django template language are relevant to the Template Inheritance? Select all that apply.
- extends
- include
- csrf_token
- static
Question 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
- World
- Hello World
Question 7)
Complete the following sentence. Form validation must ideally occur on ________________
the server-side.the client-side.- neither the client nor server side, but in the middleware of the web framework.
- both the client-side and server-side.
Question 8)
What special character matches zero or more characters while using Regular Expressions?
- * (star)
- + (plus)
- # (hash)
- ^ (caret)
Question 10)
Regarding user experience when building a website, the Menu information needs to be present on all pages. What are some advantages of placing that menu inside the header section inside a template? Select all that apply.
- Easy navigation
- Good user interface
- Consistency
- Efficient memory management
- Makes the webpage more secure
Question 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?
- Database version
- Database name
- Port
- Address
Question 4)
Which of the following are the advantages of using Function-based views?
- Code reusability
- Explicit code flow
- Code can be extended to include more functionalities.
- Use of decorators
Question 6)
When performing migrations, what is the expected output produced if you run the following query on the command line?
python3 manage.py sqlmigrate
Use of decorators
It will run the SQL queries required to perform migrations.- It will show the operations and dependencies performed in migrations.
- It will show the SQL queries run during the migrations.
Question 8)
The DRY principle in Django that promotes code reusability is an acronym for:
Don’t recycle yourself- Dynamically repeat yourself
- Don’t repeat yourself
- Doubly repeat yourself
Question 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:
class MenuTestCase(<class object to be passed>):
- TestCase
- TestUnit
- UnitCase
- UnitTest
Question 2)
Which is NOT an advantage of tracking migrations over a database?
- Reduces processing time
- Avoid repetitions
- Track user-specific changes
- Provides a centralized source to track changes
Question 5)
Which package provides Django’s authentication and authorization system?
- django.apps
- django.contrib.admin
- django.core.wsgi
- django.contrib.auth
Question 6)
In setting up a Django application, at what point among the options below is the SQLite database db.sqlite3 created and added to the project directory?
- When you perform migrations for the first time
- When you run the server for the first time
- When you create the project
- When you create an app
Question 7)
Django uses the Django Template Language to separate the logic for which two layers?
- Presentation and application layer
- Presentation and data layer
- Application and data layer
Question 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.
list- dictionary
- dynamic
- tuple
- Lack of debugger tool inside IDE such as VS Code
- Incomplete understanding of data structures
- Interlinked files
- Package dependencies
- settings
- showmigrations
- runserver
- shell
Question 1)
While using the include tag, there is no shared state between included templates.
- True
- False
Question 9)
Using the helper function in Django, which of the following is valid code to create a new user in Django?
Note: mario is the username, pass@123 is the password and [email protected] is the email address.
- User.objects.create_user(‘mario’, ‘pass@123’, ‘ [email protected] ‘)
- User.objects.create_user(‘[email protected] ‘, ‘mario’, ‘pass@123’)
- User.objects.create_user(‘mario’, ‘[email protected]’, ‘pass@123’)
- Mario.objects.create_user(‘[email protected] ‘, ‘pass@123’)