Skip to content

Quiz

1. The full form of CSRF is

a. Cross-Scripting Request Forgery
b. Cross-Site Request Forgery
c. Cross-Site Request Force
d. Cross-Site Response Forgery
Answer b. Cross-Site Request Forgery
Explanation: CSRF stands for Cross-Site Request Forgery. It is a type of web vulnerability that allows attackers to execute unauthorized actions on a website on behalf of a legitimate user.

2. When do we raise HTTP404 exception ?

a. When the user is not authorized to access the view.
b. When the user is not authenticated
c. When the resource is not found in the server or database.
d. When the server encounters internal error.
Answer c. When the resource is not found in the server or database.
Explanation: The HTTP404 code means that a server could not find a client-requested resource.

3. What is the purpose of the Django reverse function?

a. To return the reverse of a string
b. To generate a URL based on a view function or name
c. To reverse the order of elements in a list
d. To reverse the order of elements in a database query
Answer b. To generate a URL based on a view function or name
Explanation: In Django, the reverse() function is used to generate URLs based on a view function or a URL pattern name. It takes a view function or URL pattern name as its argument and returns a URL as a string.