# Django Web Framework - Module Quiz: Templates

1. **Which of the following sentences about templates are true?** Select all that apply.
    
    * A template is a web page that has blocks of template language syntax inside the HTML script.
        
    * <mark>A template extracts the data from a model and generates a dynamic page.</mark>
        
    * <mark>A template helps to include conditional processing logic in a web page.</mark>
        
    * A template is the data layer of the application.
        
2. **The view function loads a template and fills the context data in it.**
    
    * <mark>True</mark>
        
    * False
        
3. **Which of the following tags are used for implementing template inheritance?** Select all that apply.
    
    * <mark>{% extends %}</mark>
        
    * {% include %}
        
    * <mark>{% block %}</mark>
        
    * {% endfor %}
        
4. **True or false. To implement template inheritance, the parent template must have the name** `base.html`**.**
    
    * True
        
    * <mark>False</mark>
        
5. **In which module is the** `render()` **function defined?**
    
    * django.urls
        
    * <mark>django.shortcuts</mark>
        
    * django.db
        
    * django.contrib
        
6. **Which of the following template filters returns a** `titlecase` **representation of a string?**
    
    **Hint:** **titlecase** makes words start with an uppercase character and the remaining characters lowercase.
    
    * upper
        
    * lower
        
    * <mark>title</mark>
        
    * length
        
7. **Putting one loop inside another is called nesting of loops. Can you use nested loops in a template?**
    
    * <mark>Yes</mark>
        
    * No
        
8. **Complete the sentence. The view function passes a \_\_\_\_\_\_ as the context data to a template.**
    
    * Python list
        
    * Python string
        
    * <mark>Python dict</mark>
        
    * Python tuple
        
9. **What are the advantages of a class-based view?** Select all that apply.
    
    * <mark>Code reusability</mark>
        
    * <mark>Extensible code</mark>
        
    * Class-based views are simple to implement
        
    * Implicit code flow
        
10. **Suppose that a Django app named** `myapp` **has the Employee model. Which of the following statements about the generic** `ListView` **class are correct?** Select all that apply.
    
    * A generic `ListView` class must be named `EmployeeList`
        
    * A generic `ListView` class should set the model attribute to `myapp_Employee`
        
    * <mark>A generic </mark> `ListView` <mark> class lists all the rows in the </mark> `Employee` <mark> table</mark>
        
    * A generic `ListView` class needs a template named `EmployeeList.html`
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1731216081371/97919206-943d-4be2-abc1-4b5521b05a13.png align="center")
