You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application connects to a Microsoft SQL Server 2005 database.The
connection string of the application is defined in the following manner.
"Server=Prod; Database=WingtipToys;Integrated Security=SSPI;Asynchronous
Processing=true"
The application contains the following code segment. (Line numbers are included for
reference only.)
01 protected void UpdateData(SqlCommand cmd) {
02 cmd.Connection.Open();
03
04 lblResult.Text = "Updating ...";
05 }
The cmd object takes a long time to execute.You need to ensure that the application
continues to execute while cmd is executing. What should you do?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You derive a new validation control from the BaseValidator class.The validation
logic for the control is implemented in the Validate method in the following manner.
protected static bool Validate(string value) {
...
}
You need to override the method that validates the value of the related control. Which
override method should you use?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.The application reads the following contacts.xml file.
DonHallSimonRapierShuIto
You write the following code segment. (Line numbers are included for reference only.)
01 XDocument loaded = XDocument.Load(@"C:\contacts.xml");
02
03 foreach (string name in q)
04 Console.WriteLine("{0}", name);
You need to ensure that the application outputs only the names Simon Rapier and
ShuIto.Which code segment should you insert at line 02?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.You write the following code segment. (Line numbers are included for reference
only.)
01 private List GetEmployers() {
02 List employers = new List();
03 SqlCommand cmd = new SqlCommand();
04 ...
05 XmlReader reader = cmd.ExecuteXmlReader();
06 while (reader.Read()) {
07
08 }
09 return employers;
10 }
The cmd object returns the following XML data structure.
ShaiBassliWingtip Toys
...
...
You need to populate the employers list with each employer entry in the XML data
structure.
Which code segment should you insert at line 07?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You add an XmlDataSource control named XmlDataSource1 to the Web page.
XmlDataSource1 is bound to an XML document with the following structure.
...
You also write the following code segment in the code-behind file of the Web page.
protected void BulletedList1_Click(object sender, BulletedListEventArgs e) {
//...
}
You need to add a BulletedList control named BulletedList1 to the Web page that is bound
to XmlDataSource1.Which code fragment should you use?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.The application uses the following LINQ query.
var query = from o in orderLinesQuery
where (string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field("SalesOrderID"),
OrderDate = o.Field("OrderDate")
};
The CarrierTrackingNumber field in the DataRow is nullable.You need to ensure that an
exception does not occur if the CarrierTrackingNumber field has a null value.Which code
segment should you use?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.You write the following code segment.
DataTable dt = new DataTable("Customer");
dt.Columns.Add("ID", typeof(Int32));
dt.Columns.Add("State", typeof(String));
dt.Columns.Add("RegionCode", typeof(String));
dt.Rows.Add(1, "WA", "MT297EM");
dt.Rows.Add(2, "CA", "MT33SG");
dt.Rows.Add(3, "NY", "MT73229MP");
var query = from c in dt.AsEnumerable() select c["RegionCode"];
foreach (string rNum in query)
You need to display only the digits from the RegionCode field. Which line of code should
you add?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You write the following code fragment.
You need to ensure that the following requirements are met:
You are creating a Windows Forms application that has the print functionality by using the
.NET Framework 3.5.You implement the PrintPage page event for the form. You associate
an instance of the PrintDocument control along with an instance of the PrintPreviewDialog
control named prevDialog1. You want to set the default size of the PrintPreviewDialog class
to full screen.You need to provide a print preview for the user by adding a code segment to
the Click event of the button on the form.Which code segment should you use?
You are creating a Windows Forms application by using the .NET Framework 3.5. You have
implemented the PrintPage event to send the page output to the printer. The users must select
the printer and the page range before printing.You need to ensure that users can print the
content of the form by clicking the button control.Which code segment should you use?