Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Appendix A. Answers to Quiz Questions
Quiz
1:
What must ASP.NET do before it sends anything to the browser?
A1:
Convert the output to HTML so the browser can understand it.
2:
What does CLR stand for?
A1:
Common Language Runtime.
3:
What is metadata?
A1:
Information produced by an application to describe its properties. The Common Language Runtime uses metadata to load and run applications.
4:
What are three programmatic improvements of ASP.NET over ASP?
A1:
Ease of deployment, improved session state, and the use of code declaration blocks.
5:
How does ASP.NET work with the client and server machines?
A1:
ASP.NET uses client-side code to send messages back to the server. Thus, the server can be aware of what's happening on the client.
6:
Why can't you simply double-click on an ASP.NET file to run it?
A1:
An ASP.NET page must be processed by a Web server. If you double-click on it, you're trying to open the file without using that process.
7:
What is a virtual directory?
A1:
A folder on your computer that can be accessed from a browser as though it were in your root directory (typically, c:\inetpub\wwwroot).
8:
If you created a file called hello.aspx and placed it in the c:\inetpub\wwwroot\tyaspnet21days\MyApplication directory, how could you access it from the Web browser?
What's the difference between code declaration blocks and render blocks?
A1:
Code render blocks are inline code, denoted by <% and %> tags, and aren't compiled. Code declaration blocks define a page's methods and members, are denoted by script tags, and are compiled.
Exercises
Q1:
What will be the output of the following ASP.NET page? Where would you save this file so users could access it?
1: <%@ Page Language="VB" %> 2: 3: <script runat="server"> 4: sub Page_Load(Sender as Object, e as EventArgs) 5: lblMessage.Text = "This is my first exercise!" 6: end sub 7: </script> 8: 9: <html><body> 10: <asp:Label runat="server"/> 11: </body></html>
A1:
This page would display "This is my first exercise!" You could save this file in the c:\inetpub\wwwroot\tyaspnet21days\day1 folder as exercise1.aspx and view it through the browser with http://localhost/tyaspnet21days/day1/exercise1.aspx.