Microsoft TS: Microsoft .NET Framework 2.0 - Web-based Client Development Sample Questions:
1. You create a Web Form that displays a GridView. The GridView's data source is a DataSet named
dsOrders.
The DataSet contains two DataTables named Orders and OrderDetails.
You create a relation between the two DataTables using the following code segment. (Line numbers are
included for reference only.)
01 dtOrders = dsOrders.Tables["Orders"];
02 dtOrderDetails = dsOrders.Tables["OrderDetails"];
03 colParent = dtOrders.Columns["OrderID"];
04 colChild = dtOrderDetails.Columns["ParentOrderID"];
05 dsOrders.Relations.Add("Rel1", colParent, colChild, false);
You need to find the cause of the exception being raised in line 05.
What should you do?
A) Ensure that the child column and the parent column have the same names.
B) Ensure that the tables have an explicit relationship defined by a foreign key constraint in the database.
C) Ensure that the child column and the parent column have the same data types.
D) Ensure that the child table and the parent table have the same names.
E) Ensure that each row in the child table has a corresponding row in the parent table.
2. You create a Web Form. The Web Form displays sales information as a chart.
The chart must be rendered to the user's browser as a .jpeg file.
The chart is retrieved by using the following code segment.
Dim bmpChart As Bitmap = Chart.GetCurrentSales()
You need to display the chart to the user.
Which code segment should you use?
A) Response.ContentType = "text/html" bmpChart.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.MemoryBmp) bmpChart.Dispose()
B) Response.ContentType = "image/bitmap" bmpChart.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp) bmpChart.Dispose()
C) Response.ContentType = "image/jpeg" bmpChart.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) bmpChart.Dispose()
D) Response.ContentType = "text/jpeg" bmpChart.Save(Request.InputStream, System.Drawing.Imaging.ImageFormat.Jpeg) bmpChart.Dispose()
3. You are developing a Web page that will allow a user to upload a file on your Web site.
You have defined the following file upload control on the Web page.
<asp:FileUpload ID="uploadFile" runat="server" /><br />
<asp:Button ID="btnUploadFile" runat="server"
Text="Upload File"
OnClick="btnUploadFile_Click"/>
You need to verify whether a file has been selected. You also need to save the file to a subfolder named uploads on the Web site.
Which code segment should you use?
A) If uploadFile.HasFile Then uploadFile.SaveAs(Server.MapPath("uploads/" & uploadFile.PostedFile.ToString())) End If
B) If uploadFile.HasFile Then uploadFile.SaveAs(Server.MapPath("uploads/" & uploadFile.FileName)) End If
C) If Not uploadFile.HasFile Then uploadFile.SaveAs("uploads/" & uploadFile.FileName) End If
D) If uploadFile.HasFile Then uploadFile.SaveAs("uploads/" & uploadFile.PostedFile.ToString()) End If
4. You are creating a Web application.
The application contains a DataSet named myDataSet.
You need to fill myDataSet from an XML document. You also need to ensure that the current schema contained in myDataSet, including tables, is extended.
Which code segment should you use?
A) myDataSet.ReadXml("input.xml", XmlReadMode.DiffGram)
B) myDataSet.ReadXml("input.xml", XmlReadMode.ReadSchema)
C) myDataSet.ReadXml("input.xml", XmlReadMode.InferSchema)
D) myDataSet.ReadXml("input.xml", XmlReadMode.Fragment)
5. You create a master page named Parent.master that contains a global header for your Web application.
You add a ContentPlaceHolder to Parent.master by using the following code segment.
<asp:ContentPlaceHolder ID="pagebody" runat="server" />
You also create a content page named Article.aspx by using the following code segment.
<%@ Page Language="VB" MasterPageFile="~/navigation.master"%>
<asp:Content ContentPlaceHolderID="article" Runat="Server">
Article content to go here
</asp:Content>
You need to create a child master page that contains the navigation for each section.
The users must be able to see the header, the navigation, and the article when they view the page, as
shown in the exhibit.
Which code segment should you use?
A) <%@ Master Language="VB" MasterPageFile="~/parent.master"%> <asp:Content runat="server" ContentPlaceHolderID="article"> Navigation element 1<br /> Navigation element 2<br /> <asp:contentplaceholder id="pagebody" runat="server"> </asp:contentplaceholder> </asp:Content>
B) <%@ Master Language="VB" MasterPageFile="~/parent.master"%> <asp:Content runat="server" ContentPlaceHolderID="pagebody"> Navigation element 1<br /> Navigation element 2<br /> <asp:contentplaceholder id="article" runat="server"> </asp:contentplaceholder> </asp:Content>
C) <%@ Master Language="VB" MasterPageFile="~/parent.master"%> <asp:Content runat="server" ContentPlaceHolderID="article"> <asp:contentplaceholder id="pagebody" runat="server"> Navigation element 1<br /> Navigation element 2<br /> </asp:contentplaceholder> </asp:Content>
D) <%@ Master Language="VB" MasterPageFile="~/parent.master"%> <asp:Content runat="server" ContentPlaceHolderID="pagebody"> <asp:contentplaceholder id="article" runat="server"> Navigation element 1<br /> Navigation element 2<br /> </asp:contentplaceholder> </asp:Content>
Solutions:
| Question # 1 Answer: C | Question # 2 Answer: C | Question # 3 Answer: B | Question # 4 Answer: C | Question # 5 Answer: B |
We're so confident of our products that we provide no hassle product exchange.


By Paddy

