PrepAway - Latest Free Exam Questions & Answers

Which line of code should you insert at line 09?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application
that connects to a Microsoft SQL Server 2008 database. You add the following table to the database.

CREATE TABLE ObjectCache (
Id INT IDENTITY PRIMARY KEY,
SerializedObjectData XML)

You write the following code segment to retreive records from the ObjectCache table.
(Line numbers are included for reference only.)

01 string s = GetConnectionStringFromConfigFile(“xmldb”);
02 using (SqlConnection conn = new SqlConnection(s))
03 using (SqlCommand cmd = new SqlCommand(“select * from ObjectCache”, conn))
04 {
05 conn.Open();
06 SqlDataReader rdr = cmd.ExecuteReader();
07 while(rdr.Read())
08 {
09 …
10 DeserializeObject(obj);
11 }
12 }

You need to retreive the data from the SerializedObjectData column and pass it to a method named DeserializeObject.
Which line of code should you insert at line 09?

PrepAway - Latest Free Exam Questions & Answers

A.
XmlReader obj = (XmlReader)rdr[1];

B.
SByte obj = (SByte)rdr[1];

C.
String obj = (String)rdr[1];

D.
Type obj = (Type)rdr[1];


Leave a Reply