backend development for .net full stack coursera week 2 answers
MVC Advanced - Practice Quiz
1. What is the main difference between ASP.NET MVC and ASP.NET Web Forms?
- ASP.NET MVC uses a page-based programming model, while ASP.NET Web Forms uses a control-based programming model.
- ASP.NET MVC separates an application into three main components: model, view, and controller, while ASP.NET Web Forms does not separate an application into distinct components.
- ASP.NET MVC is designed for building small applications, while ASP.NET Web Forms is designed for building large applications.
- ASP.NET MVC is based on the Ruby on Rails framework, while ASP.NET Web Forms is based on the Java Spring framework.
2. What is the main advantage of using ASP.NET MVC over ASP.NET Web Forms?
- ASP.NET MVC provides better performance than ASP.NET Web Forms.
- ASP.NET MVC is easier to learn and use than ASP.NET Web Forms.
- ASP.NET MVC provides better control over HTML and URL structure, making it more suitable for search engine optimization (SEO).
- ASP.NET MVC offers better security features than ASP.NET Web Forms.
3. What is the purpose of the "Views" folder in an ASP.NET MVC application?
- It contains code for handling HTTP requests and generating HTTP responses.
- It contains code for generating HTML responses based on the data provided by the model.
- It contains configuration settings for the ASP.NET MVC application.
- It contains JavaScript and CSS files used by the ASP.NET MVC application.
4. Which of the following best describes an action method in an ASP.NET MVC application?
- It is a method that processes a request for a view and returns the appropriate HTML response.
- It is a method that defines the layout for the application.
- It is a method that handles the routing of requests to the appropriate controller.
- It is a method that handles HTTP requests and returns an ActionResult object that specifies the response to be sent back to the client.
Entity - Practice Quiz
5. What is Entity Framework?
- A front-end framework for building responsive web applications.
- An ORM framework for .NET applications.
- A JavaScript library for building user interfaces.
- A cloud-based platform for building and deploying web applications.
6. What is Code First approach in Entity Framework?
- A way to generate database tables and columns automatically based on code.
- A way to generate code automatically based on database schema.
- A way to create a database schema by hand-coding SQL scripts.
- A way to map existing database schema to code.
7. What is CRUD in Entity Framework?
- An abbreviation for “Create, Retrieve, Update, Delete”, which refers to the four basic operations that can be performed on data in a database.
- An abbreviation for “Code, Run, Update, Deploy”, which refers to the four basic steps in a software development life cycle.
- An abbreviation for “Customer Relationship Management and User Data”, which refers to the two main types of data stored in a database.
- An abbreviation for “Connect, Retrieve, Update, Disconnect”, which refers to the four basic steps in a database connection process.
8. What is the purpose of a stored procedure in Entity Framework?
- To provide a way to retrieve data from a database using LINQ.
- To provide a way to update data in a database using LINQ.
- To encapsulate database logic and execute it on the server side.
- To provide a way to create database schema using code.
9. What is paging in Entity Framework?
- A technique for limiting the amount of data returned from a database query to improve performance and reduce memory usage.
- A technique for joining multiple tables in a database query to retrieve related data.
- A technique for sorting data returned from a database query in ascending or descending order.
- A technique for filtering data returned from a database query based on certain criteria.
Pipeline & Security Practice Quiz
10. What is the purpose of unit testing in software development?
- Unit testing is performed to ensure the proper functioning of hardware components.
- Unit testing is used to verify the integration of different software systems.
- Unit testing is performed to identify and fix bugs or issues in isolated sections of code.
- Unit testing is used to validate the user interface and user experience of a software application.
11. What is the ASP.NET MVC pipeline?
- A series of filters that are executed before an action method is called.
- The sequence of events that occur during an HTTP request and response in an ASP.NET MVC application.
- A set of predefined middleware components that handle requests and responses in an ASP.NET MVC application.
- The set of configuration settings that determine how an ASP.NET MVC application handles HTTP requests and responses.
12. What are ASP.NET MVC filters?
- Components that handle requests and responses in an ASP.NET MVC application.
- Attributes that can be applied to controllers and action methods to perform logic before or after the action method is executed.
- Methods that are called before and after an action method is executed in an ASP.NET MVC application.
- A set of predefined middleware components that handle requests and responses in an ASP.NET MVC application.
13. What is the purpose of filters configurations in ASP.NET MVC?
- To specify the routing configuration for an ASP.NET MVC application.
- To specify the order in which filters are executed and which filters apply to which action methods.
- To specify the authentication and authorization settings for an ASP.NET MVC application.
- To specify the connection string and database provider for an ASP.NET MVC application.
14. What is a view model in ASP.NET MVC?
- A class that defines the structure of a database table.
- A class that represents a single record from a database table.
- A class that is used to pass data from a controller to a view.
- A class that is used to define the routing configuration for an ASP.NET MVC application.
MVC - Graded Quiz
15. What is Forms Authentication in ASP.NET?
- It is a mechanism to authenticate users using biometric data.
- It is a mechanism to authenticate users using social media accounts.
- It is a mechanism to authenticate users using credentials stored in a database.
- It is a mechanism to authenticate users using OAuth 2.0 tokens.
16. Which attribute is used to enable Forms Authentication in ASP.NET?
- forms
- authentication
- authorization
- membership
17. Which configuration file is used to configure Forms Authentication in ASP.NET?
- appsettings.json
- web.config
- launchSettings.json
- program.cs
18. What is the purpose of the "AllowAnonymous" attribute in ASP.NET?
- It allows anonymous users to access protected resources.
- It requires users to provide additional credentials for access.
- It blocks access to resources for all users.
- It disables authentication for a specific action or controller.
19. What is the purpose of the "FormsAuthenticationTicket" class in ASP.NET?
- It is used to encrypt and decrypt user credentials.
- It is used to store user credentials in a secure manner.
- It is used to create an authentication ticket for a user after successful authentication.
- It is used to validate user credentials against a database.
20. What is the purpose of Forms Authentication in ASP.NET?
- To encrypt sensitive data in web forms.
- To authenticate and authorize users for accessing resources in a web application.
- To create and manage user accounts in a web application.
- To prevent cross-site scripting (XSS) attacks in a web application.
21. Which of the following is a standard security protocol used for secure communication over the internet?
- FTP
- SMTP
- SSL/TLS
- HTTP
22. What is Cross-Site Scripting (XSS) attack?
- An attack where the attacker intercepts and modifies data between two parties.
- An attack where the attacker gains access to a user’s password.
- An attack where the attacker injects malicious scripts into a web page viewed by other users.
- An attack where the attacker gains access to a user’s computer by exploiting a vulnerability in a software application.
23. What is the purpose of the Anti-Forgery Token in ASP.NET?
- To prevent cross-site scripting (XSS) attacks.
- To encrypt sensitive data in web forms.
- To prevent Cross-Site Request Forgery (CSRF) attacks.
- To authenticate and authorize users for accessing resources in a web application.
24. What is the purpose of the "Authorize" attribute in ASP.NET Core?
- To encrypt sensitive data in web forms.
- To define the URL path for a specific route in an ASP.NET Core application.
- To restrict access to a controller or action method to authenticated users.
- To define the HTTP method to use for a controller action method in an ASP.NET Core application.
25. What is the purpose of the "AllowAnonymous" attribute in ASP.NET Core?
- To allow anonymous access to a controller or action method that is otherwise restricted to authenticated users.
- To encrypt sensitive data in web forms.
- To define the URL path for a specific route in an ASP.NET Core application.
- To define the HTTP method to use for a controller action method in an ASP.NET Core application.
26. What is the purpose of the "ValidateAntiForgeryToken" attribute in ASP.NET?
- To prevent Cross-Site Request Forgery (CSRF) attacks.
- To encrypt sensitive data in web forms.
- To define the URL path for a specific route in an ASP.NET Core application.
- To validate that the anti-forgery token is present and valid in a form submission.
27. What is the purpose of the "Authentication" middleware in ASP.NET Core?
- To validate that the anti-forgery token is present and valid in a form submission.
- To encrypt sensitive data in web forms.
- To handle user authentication and establish an identity for the user.
- To prevent Cross-Site Request Forgery (CSRF) attacks.
28. What is the purpose of the ASP.NET Identity framework?
- To provide a way to authenticate users using Facebook or Google accounts.
- To provide a framework for user authentication and authorization in ASP.NET applications.
- To provide a way to manage CSS and JavaScript files in an ASP.NET application.
- To provide a way to easily create HTML forms in an ASP.NET application.
29. What is a SQL injection attack?
- An attack in which the attacker steals a user’s session ID and uses it to impersonate the user.
- An attack in which the attacker exploits a vulnerability in a web application’s input validation and injects malicious SQL code into a query, allowing the attacker to view, modify, or delete data in the database.
- An attack in which the attacker intercepts and modifies data transmitted between a client and server.
- An attack in which the attacker exploits a vulnerability in a web application’s authentication system to gain unauthorized access to sensitive data.
30. What is two-factor authentication?
- A security measure that requires users to enter a username and password.
- A security measure that requires users to enter a password and answer a security question.
- A security measure that requires users to provide two forms of identification, typically a password and a unique code sent to their mobile device or email address.
- A security measure that requires users to complete a CAPTCHA challenge to prove they are human.
31. What is the purpose of a salt in password hashing?
- To add flavor to the hashed password.
- To store the password in plain text in the database.
- To add random data to the password before hashing, making it more difficult for attackers to use precomputed lookup tables to crack the hashed password.
- To add a secret key to the password before hashing, making it more difficult for attackers to crack the hashed password.
32. What is the purpose of the HTTPOnly flag in a cookie?
- To ensure that the cookie can only be accessed by the domain that created it.
- To prevent the cookie from being sent over an unencrypted connection.
- To prevent JavaScript code from accessing the cookie, which can help prevent cross-site scripting (XSS) attacks.
- To set an expiration date for the cookie.
33. What is the purpose of role-based authorization?
- To authenticate users based on their role in the organization.
- To restrict access to certain features or resources in a web application based on a user’s role in the organization.
- To encrypt sensitive data transmitted between a client and server.
- To prevent Cross-Site Request Forgery (CSRF) attacks.