# Django Web Framework - Module Quiz: Views

1. **To add a URL pattern with regex, you use the** `re_path()` **function instead of the** `path()` **function.**
    
    * <mark>True</mark>
        
    * False
        
2. **Which of the following sentences about the** `path()` **function is correct?** Select all that apply.
    
    * <mark>The </mark> `path()` <mark> function is defined in the </mark> `django.urls` <mark> module.</mark>
        
    * The URL string parameter of the `path()` function captures query parameters from the URL.
        
    * <mark>The </mark> `path()` <mark> function is used to define a URL pattern.</mark>
        
    * The `path()` function returns the path of the Django app.
        
3. **Complete the sentence. The path converters capture \_\_\_\_\_ from the URL.**
    
    * Query parameters
        
    * URL parameters
        
    * Body parameters.
        
    * <mark>Path parameters</mark>
        
4. **The** `request.user` **attribute contains the information of the current user.**
    
    * <mark>True</mark>
        
    * False
        
5. **Complete the following sentence. The HTTP status code starting with 5 implies that:**
    
    * The request has been received and is under process.
        
    * There is a client-side error.
        
    * The action has been successfully completed.
        
    * <mark>The server has encountered an error.</mark>
        
6. **What are the important features of a class-based view?** Select all that apply.
    
    * <mark>Class-based views are reusable.</mark>
        
    * <mark>A class-based view subclasses the </mark> `django.view`<mark>.View base class.</mark>
        
    * <mark>The </mark> `as_view()` <mark> method maps a URL to a class-based view.</mark>
        
    * <mark>A class-based view implements different methods for each HTTP method.</mark>
        
7. **The** `Http404` **response is a convenient alternative for an** `HttpResponse`**.**
    
    * <mark>True</mark>
        
    * False
        
8. **Complete the following sentence. The URL name is \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.**
    
    Select all that apply.
    
    * <mark>used by the </mark> `reverse()` <mark> function to fetch the URL mapped with the view function.</mark>
        
    * an optional parameter passed inside the `path()` function.
        
    * used to define URL namespace.
        
    * <mark>passed as the </mark> `name` <mark> parameter in the </mark> `path()` <mark> function.</mark>
        
9. **Can you define views in the** [`views.py`](http://views.py) **file in the projects folder?**
    
    * <mark>Yes</mark>
        
    * No
        
10. **Complete the following sentence. To override the default error view, \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.**
    
    Select all that apply.
    
    * <mark>specify the appropriate handler in the project's URLConf.</mark>
        
    * define the custom view in the project folder.
        
    * <mark>you should define the custom error handler view in the app's </mark> [`views.py`](http://views.py) <mark> file.</mark>
        
    * there's no need to override the default error views.
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1731211666429/f4307b0d-c1d5-49ed-b93c-be2336d68567.png align="center")
