Developing Applications with SQL, Databases, and Django Week 01 Quiz Answers
Q1. Which of the following statements are correct about databases?
- A database is a repository of data
- There are different types of databases – Relational, Hierarchical, NoSQL, etc.
- A database can be populated with data and be queried
- All of the above
Q2. A database stores data in tabular form only. True or False?
Q3. In a library entity-relationship data model, a book is an example of _____ and the book’s title, edition, and publication date are examples of _______.
- an attribute, entities
- an entity, attributes
- a row, columns
- an entity, properties
Q4. Which of the following statements about a database is/are correct?
- A database is a logically coherent collection of data with some inherent meaning
- Data can only be added and queried from a database but not modified
- Only SQL can be used to query data in a database
- All of the above
Q5. The primary key of a relational table uniquely identifies each row in a table. True or False?
Developing Applications with SQL, Databases, and Django Week 02 Quiz Answers
Q1. Which of the following is a benefit of using ORM?
- Easier to debug
- Speeds up application development
- Increases performance
- Removes data access complexity from application code
Q2. When you create an object (an instance of a class) in Django, what does it represent?
- Table cell
- Table column
- Table row
- Database table
Q3. What does Django create when you create a forward relationship?
- Comparative clause
- Django doesn’t automatically create anything
- Backward access
- Explicit reference
Q4. To delete() records in a database, you call the Delete method on which objects?
- Filter chain or primitive field
- Model object or QuerySet
- Child object or lookup parameter
- Foreign Key field or Many-to-many field
Q5. What is the main reason ORM was invented?
- Bridge the gap between OOP and SQL
- Promote SQL
- Utilize methods
- Use a different set of APIs for each database
Q6. Multi-table inheritance is like which relationship?
Q7. What method would you use to create a subset of database records?
Q8. How do you specify what happens to related objects when an object is deleted?
- Delete foreign key
Q9. Django only requires that model relationships be defined on one side. What is this called?
- Related object
- Child object
- Singular access
- Forward access
Developing Applications with SQL, Databases, and Django Week 03 Quiz Answers
Q1. What else does the Django template contain besides Python code?
- Static HTML elements
- Markdown elements
- Dynamic HTML elements
- XML elements
Q2. Three files are created by Django after you’ve created a project. Which of these files is a command-line interface used to interact with the Django project?
Q3. For the onlinecourse example, when registering the course and instructor models in the Django admin site, you would write and run “admin.site.register(Course)” and what other code statements?
Q4. When you map a URL to the course view, what file do you add path objects to?
Q5. Django template files display content, such as course names and descriptions. How is the content displayed?
- Plain text
Q6. Which is one of the differences between the Django MVT and the MVC design pattern?
- MVC has a Model
- There is no difference
- MVT has a View
- The Django framework or Django server itself acts as controller
Q7. What two development tasks need to be performed to manage and determine which data will be presented to the UI?
- Access data and build tables
- Model data and create views
- Sort data and sort views
- Control the project
Q8. Which command is used in the Django Admin video to start the server?
- python manage.py run
- python manage.py startDjango
- python manage.py runserver
- python manage.py startserver
Q9. Django functions, like View, accept arguments as input and return something. Typically, View needs an HTTP request object as the first argument. What does this request object contain?
- Python commands
- Python scripts
- Django static files
- Read-only HTTP metadata
Q10. Django template file structure sometimes has two files created with the same name. How do you ensure Django points to the correct file?
- Add an identifier
- Note the differences
- Name spacing
- Add metadata
Developing Applications with SQL, Databases, and Django Week 04 Quiz Answers
Q1. Django class-based view needs to be mapped with a URL pattern, almost like configuring the URL for the function-based view. The only difference is you need to specify:
- The as_class method
- The as_view function
- The view_base method
- The as_config function
Q2. Username and password can be received from a user via a login HTML template. Which HTTP method is used to sent username/password to the onlinecourse login view, in order to authenticate the user?
- GET request
- DELETE request
- POST request
- None of the above
Q3. In the Django Bootstrap video, a course index page is designed that contains courses represented as cards. The multiple course cards are then added to a container. How are the multiple course cards managed?
- Wrapped in a card deck
- Placed in a list
- Added to a table
Q4. Django provides a default staticfiles app that collects all static files in a single directory. You can move all static files to this directory when you deploy your app to a production web server. There are several steps to do this. What call do you make in the last step?
- Run “importstatic” command line
- Run ‘collectstatic’ command line
Q5. ASGI is another web server interface that Django apps support. What is the main difference between WSGI and ASGI?
- There is no difference
- WSGI supports Python
- ASGI supports Python
- ASGI supports asynchronous code
Q6. Which type of view was created to address view extensibility and reusability?
- Method-based view
- HTTP-based view
- Class-based view
- Function-based view
Q7. Does authorization occur before, after, or during the authentication process?
- Before authentication
- After authentication
- During authentication
- Authentication doesn’t affect authorization
Q8. How can you use Bootstrap CSS style classes without manually downloading and importing it?
- Copy & paste the CSS style classes
- You must download Bootstrap
- Add a link to the latest Bootstrap version into the head element of your HTML template
- Link to the Bootstrap web page before you develop your webpage
Q9. Django apps can have app-specific static files but can also have external static files. Where do you define the directories for external static files, so you can find them?
- In the STATICFILES_DIRS list in settings.py file
- In the PROPERTIES list in manage.py
- In EX_DIRS list in settings.py file
- In STATIC list in manage.py file
Q10. WSGI is the main Python standard for communicating between web servers and applications. To make Django apps work with WSGI the startproject command line creates a file that declares an application callable by default. What is this file named?