ASP.NET Web Forms Quiz
This quiz covers common aspects of ASP.NET Web Forms. A detailed answer key is provided, along with links to related information.
Note: This quiz was originally created to accompany the tutorial series Getting Started with ASP.NET 4.5 Web Forms and Visual Studio 2013 and the related sample Getting Started with ASP.NET 4.5 Web Forms and Visual Studio 2013 - Wingtip Toys. For more recent ASP.NET topics, see ASP.NET 5 Documentation.
1. Which type of developer would prefer the ASP.NET Web Forms framework when building a web application?
A. A developer that prefers patterns and principles such as test-driven development, separation of concerns, inversion of control (IoC), and dependency injection (DI).
B. A developer that prefers a simple web development story, along the lines of PHP. Where they would create HTML pages and then add server-based code to the page.
C. A developer that prefers a declarative, control-based programming approach with a WYSIWYG designer-driven development model.
2. An ASP.NET master page can define a consistent appearance and behavior for multiple pages in your application.
3. A Web.config file can be used to restrict access to pages in a folder of your Web application?
4. The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-level events raised by ASP.NET.
5. ASP.NET Identity allows users to log into an ASP.NET Web Forms site using which of the following credentials? Choose all that apply.
B. Windows Live
6. Which of the following SQL Server Express LocalDB answers are true? Choose all that apply.
A. SQL Server Express LocalDB is a lightweight version of SQL Server that has many programmability features of a SQL Server database.
B. SQL Server Express LocalDB runs in user mode and has a fast, zero-configuration installation that has a short list of installation prerequisites.
C. In Microsoft SQL Server, any database or Transact-SQL code can be moved from SQL Server Express LocalDB to SQL Server and SQL Azure without any upgrade steps.
7. The ASP.NET Web Forms Application template supports HTML5.
9. Bootstrap, which is supported in Visual Studio 2013 project templates, is which of the following:
A. A specialized startup mini-application used to help spin up a new server containing the Web Form application.
B. A layout and theming framework created by Twitter.
C. A packaging system used when porting the Web Forms application.
10. The ASP.NET Web Forms Application template includes a set of NuGet packages. Which of the following is true about NuGet? Choose all that apply.
A. NuGet packages provide componentized functionality in the form of open source libraries and tools.
B. There is a wide variety of online packages to help you create and test your applications that you can add to your application directly through Visual Studio.
C. Developers can create and add packages to NuGet.
13. Entity Framework Code First is:
A. A database that you must create separately from scratch.
B. A framework that allows to generate a database without defining a model.
C. A way of creating the database portion of your application for you based on the code that you write.
D. A way to reverse engineer a model from an existing database.
14. Language-Integrated Query (LINQ) extends powerful query capabilities to the language syntax of C# and Visual Basic so that you can implement standard, easily-learned patterns for querying and updating data.
15. A data annotation attribute can be used to do which of the following? Choose all that apply.
A. Specify the initial value of a property.
B. Describe how to validate user input for a property.
C. Specify whether a property is required.
D. Specify that a property participates in optimistic concurrency checks.
E. Indicate whether a data field is editable.
16. Model Binding allows you to bind results using far less code and gives you the ability to reuse the functionality throughout your application. Model binding aims to simplify working with code-focused data-access logic while still retaining the benefits of a rich, data-binding framework.
17. Value providers allow a Web Forms application to be quickly tested by providing test data as a source of user input.
18. When you set the “ItemType” attribute of a data control, such as a GridView control, the data-binding expression “Item” is available in the markup of the control and the control becomes strongly typed.
19. URL routing allows you to specify that only a portion of your web page will be sent to the user of your application.
20. When working with an ASP.NET Web Forms application, the exception handling hierarchy executes which of the following last?
A. Application level
B. Page level
C. Code level
ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.
ASP.NET offers four primary development frameworks:
ASP.NET Web Forms
ASP.NET MVC targets developers who are interested in patterns and principles like test-driven development, separation of concerns, inversion of control (IoC), and dependency injection (DI). This framework encourages separating the business logic layer of a web application from its presentation layer.
ASP.NET Web Pages
ASP.NET Web Pages targets developers who want a simple web development story, along the lines of PHP. In the Web Pages model, you create HTML pages and then add server-based code to the page in order to dynamically control how that markup is rendered. Web Pages is specifically designed to be a lightweight framework, and it's the easiest entry point into ASP.NET for people who know HTML but might not have broad programming experience — for example, students or hobbyists. It's also a good way for web developers who know PHP or similar frameworks to start using ASP.NET.
ASP.NET Single Page Application
Master pages provide the look and feel and standard behavior that you want for all of the pages in your site. Together with content pages, they produce output that combines the layout of the master page with content from the content page.
Web.config is the file that controls the configuration of your ASP.NET website. Using the features of the ASP.NET configuration system, you can configure an entire server, an ASP.NET application, or individual pages. A Web.config file can be used to restrict access to pages in a folder.
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. ASP.NET is configured so that any direct URL request for the Global.asax file is automatically rejected; external users cannot download or view the code in it.
5. A, B, C, D
ASP.NET Identity is the membership system for ASP.NET applications. ASP.NET Identity makes it easy to customize profile and add Login/ LogOut functionality to the application.
6. A, B, C
SQL Server Express LocalDB is a lightweight version of SQL Server that has many programmability features of a SQL Server database. SQL Server Express LocalDB runs in user mode and has a fast, zero-configuration installation that has a short list of installation prerequisites. In Microsoft SQL Server, any database or Transact-SQL code can be moved from SQL Server Express LocalDB to SQL Server and SQL Azure without any upgrade steps. So, SQL Server Express LocalDB can be used as a developer environment for applications targeting all editions of SQL Server. SQL Server Express LocalDB enables features such as stored procedures, user-defined functions and aggregates, .NET Framework integration, spatial types and others that are not available in SQL Server Compact.
The ASP.NET Web Forms Application template supports HTML5, which is the latest version of the HTML markup language. HTML5 supports new elements and functionality that make it easier to create Web sites.
The Visual Studio 2013 project templates use Bootstrap, a layout and theming framework created by Twitter. Bootstrap uses CSS3 to provide responsive design, which means layouts can dynamically adapt to different browser window sizes. You can also use Bootstrap's theming feature to easily effect a change in the application's look and feel. By default, the ASP.NET Web Application template in Visual Studio 2013 includes Bootstrap as a NuGet package.
10. A, B, C
The ASP.NET Web Forms Application template includes a set of NuGet packages. These packages provide componentized functionality in the form of open source libraries and tools. There is a wide variety of packages to help you create and test your applications. Visual Studio makes it easy to add, remove, and update NuGet packages. Developers can create and add packages to NuGet as well.
When you install a package, NuGet copies files to your solution and automatically makes whatever changes are needed, such as adding references and changing you’re the configuration associated with your Web application. If you decide to remove the library, NuGet removes files and reverses whatever changes it made in your project so that no clutter is left. NuGet is available from the Tools menu in Visual Studio.
Entity Framework Code First is a NuGet library that enables code-centric development when you work with data. Put simply, it creates the database portion of your application for you based on the code that you write. Using the Entity Framework, you retrieve and manipulate data as strongly typed objects. This lets you focus on the business logic in your application rather than the details of how data is accessed.
Language-Integrated Query (LINQ) is a set of features introduced in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store. Visual Studio includes LINQ provider assemblies that enable the use of LINQ with .NET Framework collections, SQL Server databases, ADO.NET Datasets, and XML documents.
15. A, B, C, D, E
Data Annotations allow you to use code to describe the rules you want applied to your data model properties.
Model binding extends data binding in ASP.NET Web Forms controls to work with code-focused data access. It incorporates concepts from the ObjectDataSource control and from model binding in ASP.NET MVC. To configure a data control to use model binding to select data, you set the control's SelectMethod property to the name of a method in the page's code. The data control calls the method at the appropriate time in the page life cycle and automatically binds the returned data. There's no need to explicitly call the DataBind method.
ASP.NET Web Forms includes value providers for all of the typical sources of user input in a Web Forms application, such as the query string, cookies, form values, controls, view state, session state, and profile properties.
You can use the data-binding expression “Item” in data-binding expressions after specifying the ItemType attribute of a web control. By doing this, you and get full IntelliSense and compile-time checking support.
URL routing allows you to configure an application to accept request URLs that do not map to physical files. A request URL is simply the URL a user enters into their browser to find a page on your web site. You use routing to define URLs that are semantically meaningful to users and that can help with search-engine optimization (SEO).
In an ASP.NET Web Forms application, exceptions can be handled based on a specific handling hierarchy. An exception can be handled first at the application level, then at the page level, and last at the code level.
When an application handles exceptions, additional information about the exception that is inherited from the Exception class can often be retrieved and displayed to the user. In addition to application, page, and code level, you can also handle exceptions at the HTTP module level and by using an IIS custom handler.