ASP.NET Web Forms Quiz

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.

A. True

B. False

 

3. A Web.config file can be used to restrict access to pages in a folder of your Web application?

A. True

B. False

 

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.

A. True

B. False

 

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.

A. Facebook

B. Windows Live

C. Google

D. Twitter

 

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.

A. True

B. False

 

8. Modernizr is an open-source JavaScript library that can detect whether a browser supports HTML5 features, and enable them if it does not.

A. True

B. False

 

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.

D. A JavaScript library used when handling large amounts of data.

 

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.

 

11. jQuery is a fast and concise JavaScript Library. The purpose of this library is to help simplify HTML document traversing, event handling, animating, and Ajax interactions. Is the jQuery library that is included in the ASP.NET Web Forms Application template by default?

A. True

B. False

 

12. Unobtrusive validation allows the built-in validator controls to use unobtrusive JavaScript for server-side validation logic.

A. True

B. False

 

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.

A. True

B. False

 

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.

A. True

B. False

 

17. Value providers allow a Web Forms application to be quickly tested by providing test data as a source of user input.

A. True

B. False

 

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.

A. True

B. False

 

19. URL routing allows you to specify that only a portion of your web page will be sent to the user of your application.

A. True

B. False

 

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

  

Answer Key:

1. C
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

The Web Forms framework targets developers who prefer declarative and control-based programming, such as Microsoft Windows Forms (WinForms) and WPF/XAML/Silverlight. It offers a WYSIWYG designer-driven development model, so it's popular with developers looking for a rapid application development (RAD) environment for web development. If you are new to web programming and are familiar with the traditional Microsoft RAD client development tools (for example, for Visual Basic and Visual C#), you can quickly build a web application without having experience in HTML and JavaScript.

 

ASP.NET MVC

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

ASP.NET Single Page Application (SPA) helps you build applications that include significant client-side interactions using HTML 5, CSS 3 and JavaScript. The ASP.NET and Web Tools 2012.2 Update ships a new template for building single page applications using knockout.js and ASP.NET Web API. In addition to the new SPA template, new community-created SPA templates are also available for download.

 Additional information:

What is Web Forms

ASP.NET Web Forms

ASP.NET MVC

ASP.NET Web Pages

ASP.NET Single Page Application

 

2. A

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.

 Additional information:

ASP.NET Master Pages

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

@ Master

 

3. A

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.

 Additional information:

How to: Create Web.config Files

ASP.NET Web Configuration Guidelines

 

4. A

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.

 Additional information:

Global.asax Syntax

 

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.

Additional Information:

ASP.NET Identity

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

 

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.

Additional information:

SQL Server Express LocalDB

 

7. A

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.

Additional information:

HTML5

 

8. A

For browsers that do not support HTML5, you can use Modernizr. Modernizr is an open-source JavaScript library that can detect whether a browser supports HTML5 features, and enable them if it does not. In the ASP.NET Web Forms Application template, Modernizr is installed as a NuGet package.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

Modernizr

 

9. B

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

Bootstrap

 

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

NuGet

 

11. A

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. The jQuery JavaScript library is included in the ASP.NET Web Forms Application template as a NuGet package.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

jQuery

 

12. B

Built-in validator controls have been configured to use unobtrusive JavaScript for client-side validation logic. This significantly reduces the amount of JavaScript rendered inline in the page markup and reduces the overall page size. Unobtrusive validation is added globally to the ASP.NET Web Forms Application template based on the setting in the <appSettings> element of the Web.config file at the root of the application.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

 

13. C

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Project

Entity Framework Code-First

 

14. A

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.

Additional Information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Data Access Layer

LINQ (Language-Integrated Query)

 

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Data Access Layer

Model Validation

System.ComponentModel.DataAnnotations Namespace

 

16. A

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Data Access Layer

Model Binding

Retrieving and displaying data with model binding and web forms

 

17. B

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Create the Data Access Layer

Value Providers

 

18. A

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - Shopping Cart

 

19. B

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).

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - URL Routing

 

20. C

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.

Additional information:

Getting Started with ASP.NET 4.5 Web Forms - ASP.NET Error Handling