Exam 70-562 : Microsoft .NET Framework 3.5, ASP.NET Application Development – 15

Question: You work as a Web Developer at Company.com. You use Microsoft ASP.NET 3.5 to create a Web application. You decide to create a SqlDataAdapter instance named TestAdapter that perform the SQL command:

SELECT * FROM Customer; SELECT * FROM Product 

You need to fill a DataSet instance from the two result sets. The first result set needs to be added to a table named CKClient and the second result should be added to a table named CKProduct. You need to determine a way to accomplish this. What should you do?

  1. You should use:
    adapter.TableMappings.Add(“Customer”, “Customer”);
    adapter.TableMappings.Add(“Products”, “Product”);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
  2. You should use:
    DataSet ds = new DataSet();
    adapter.Fill(ds.Tables[“Customer”]);
    adapter.Fill(ds.Tables[“Product”]);
  3. You should use:
    adapter.TableMappings.Add(“Table”, “Customer”);
    adapter.TableMappings.Add(“Table1”, “Product”);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
  4. You should use:
    adapter.MissingMappingAction = MissingMappingAction.Ignore;
    adapter.Fill(ds, “Customer”);
    adapter.Fill(ds, “Product”);

Correct Answer: 3


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. You need to ensure that the application is able to load staff information from an XML file into a DataSet instance. The XML file contains an inline schema. You have to call a method of the DataSet class in order to load the information. Identify how you can accomplish this?

  1. You should call the ReadXml method with the ReadSchema XML read mode.
  2. You should call the ReadXml method with the InferTypedSchema XML read mode.
  3. You should call the ReadXmlSchema method.
  4. You should call the ReadXml method with the InferSchema XML read mode.

Correct Answer: 1


Question: You work as a Web Application Developer at Company.com. You make use of .NET Framework 3.5 to create an ASP.NET application. Thereafter you decide to create a Web form that contains the subsequent code:

<asp:TextBox runat="server" ID="txtBox1" />
<asp:Button runat="server" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" />
<asp:GridView runat="server" ID="gview1" /> 

The code-behind file contains the subsequent code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim objDS As New DataSet()
Dim objDA As New SqlDataAdapter(objCmd)
objDA.Fill(objDS)
gview1.DataSource = objDS
gview1.DataBind()
Session("ds") = objDS
End Sub
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)
// add code here
End Sub 

Management wants you to make sure that the records in the gview1 GrigView control are filtered using the value of the txtBox1 TextBox as soon as the btnSubmit Button control is clicked. You need to determine the appropriate code segment that will accomplish this. What should you do?

  1. You should consider inserting the subsequent code segment at line 10:
    Dim dtbl As DataTable = TryCast(Session(“ds”), DataTable)
    Dim dview As DataView = dtbl.DefaultView
    dview.RowFilter = “Value LIKE ‘” + txtBox1.Text + “%'”
    gview1.DataSource = dview
    gview1.DataBind()
  2. You should consider inserting the subsequent code segment at line 10:
    Dim dset As DataSet = TryCast(gridCities.DataSource, DataSet)
    Dim dview As DataView = dset.Tables(0).DefaultView
    dview.RowFilter = “Value LIKE ‘” + txtBox1.Text + “%'”
    gview1.DataSource = dview
    gview1.DataBind()
  3. You should consider inserting the subsequent code segment at line 10:
    Dim dset As DataSet = TryCast(Session(“ds”), DataSet)
    Dim dtbl As DataTable = dset.Tables(0)
    Dim rows As DataRow() = dtbl.[Select](“Value LIKE ‘” + txtBox1.Text + “%'”)
    gview1.DataSource = rows
    gview1.DataBind()
  4. You should consider inserting the subsequent code segment at line 10:
    Dim dset As DataSet = TryCast(Session(“ds”), DataSet)
    Dim dview As DataView = dset.Tables(0).DefaultView
    dview.RowFilter = “Value LIKE ‘” + txtBox1.Text + “%'”
    gview1.DataSource = dview
    gview1.DataBind()

Correct Answer: 4


Question: You work as an application developer at Company.com. You are currently creating an ASP.NET application in .NET Framework 3.5 that access a database named CK_Sales on a SQL Server 2005 computer named Company-SR04. The CK_Sales database contains a table named Orders with a column named oValue. You create a DataList named DS1 that is populated by a SQL Data Source named DS1. Your application contains a web page with the following code:

<asp:DataList ID="DL1" DataSourceID="DS1" OnItemDataBound="rex" runat="server" >
<ItemTemplate>
<div>
<asp:Label ID="lblValue" Text='<%# Eval("oValue") %>' runat="server" />
</div>
</ItemTemplate>
</asp:DataList> 

Management wants your application to display the oValue column in blue when the value has more than six characters. What should you do?

  1. This can be adding to the code behind page.
    Protected Sub rex(ByVal sender As Object, ByVal e As DataListItemEventArgs)
    Dim lbloValue As Label = DirectCast(e.Item.FindControl(“lblValue”), Label)
    If lbloValue IsNot Nothing Then
    If lbloValue.Text.Length > 6 Then
    lbloValue.ForeColor = Color.Blue
    Else
    lbloVlaue.ForeColor = Color.Black
    End If
    End If
    End Sub
  2. This can be adding to the code behind page.
    Protected Sub rex (ByVal sender As Object, ByVal e As DataListItemEventArgs)
    Dim lbloValue As Label = DirectCast(e.Item.FindControl(“lblValue”), Label)
    If lbloValue.Text.Length > 6 Then
    lbloValue.ForeColor = Color.Blue
    Else
    lbloValue.ForeColor = Color.Black
    End If
    End Sub
  3. This can be adding to the code behind page.
    Protected Sub rex (ByVal sender As Object, ByVal e As EventArgs)
    Dim lbloValue As New Label()
    lbloValue.ID = “lblValue”
    If lbloValue.Text.Length > 6 Then
    lbloValue.ForeColor = Color.Blue
    Else
    lbloValue.ForeColor = Color.Black
    End If
    End Sub
  4. This can be adding to the code behind page.
    Protected Sub rex (ByVal sender As Object, ByVal e As EventArgs)
    Dim lbloValue As New Label()
    lbloValue.ID = “oValue”
    If lbloValue.Text.Length > 6 Then
    lbloValue.ForeColor = Color.Blue
    Else
    lbloValue.ForeColor = Color.Black
    End If
    End Sub

Correct Answer: 1


Question: You work as a Web Developer at Company.com. You are currently using Microsoft ASP.NET 3.5 in order to create a Web application. The following information depicts an Extensible Markup Language (XML) Web service:

[WebService]
public class CertService : WebService
{
[WebMethod]
public string[] GetAvailableExams()
{
// Omitted for brevity
}
}

You add a Web reference named CKCertServices to the applications project. You decide to make use of Microsoft Visual Studio 2008 to add the Web reference. You receive a request from management to call the GetAvailableExams Web method from a page. You should therefore determine the correct code segment you need to use to accomplish this. What should you do? (Choose all that apply)

  1. WebService baseService = new WebService();
    CKCertServices.CertService service = baseService.GetService(typeof(CKCertServices.CertService));
    string[] exams = service.GetAvailableExams();
  2. CKCertServices.CertService service = new CKCertServices.CertService();
    string[] exams = service.GetAvailableExams();
  3. ChannelFactory<CertService> factory = new ChannelFactory<CertService>();
    CertService service = factory.CreateChannel();
    string[] exams = service.GetAvailableExams();
  4. ChannelFactory<WebService> factory = new ChannelFactory<WebService>();
    CertService service = (CertService)factory.CreateChannel();
    string[] exams = service.GetAvailableExams();

Correct Answer: 2

Tagged . Bookmark the permalink.

Leave a Reply