2012年微软认证考试考前冲刺试题7
09-07
0

2012年微软认证考试备考,为了能让更多的考生考试通过,微软认证考试网特搜集了有关复习资料,帮助大家复习。以下是关于2012年微软认证考试考前冲刺试题QUESTION 13
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add a Web form that contains the following code fragment.
 
 
 
You write the following code segment for the GetData method of the DAL class. (Line numbers are included for reference only.) 
01 public object GetData() { 
02 SqlConnection cnn = new SqlConnection( ) 
03 string strQuery = "SELECT * FROM Products"; 
04 
05 } 
You need to ensure that the user can use the sorting functionality of the gvProducts GridView control.
Which code segment should you insert at line 04?
 
A.SqlCommand cmd = new SqlCommand(strQuery, cnn); 
cnn.Open(); 
return cmd.ExecuteReader();
B.SqlCommand cmd = new SqlCommand(strQuery, cnn); 
cnn.Open(); 
return cmd.ExecuteReader(CommandBehavior.KeyInfo);
C.SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn); 
DataSet ds = new DataSet(); 
da.Fill(ds); 
return ds;
D.SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn); 
DataSet ds = new DataSet(); 
da.Fill(ds); 
ds.ExtendedProperties.Add("Sortable", true); 
return ds.Tables[0].Select();

 
Answer: C
 

QUESTION 14
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You define the following class.
public class Product { 
    public decimal Price { get; set; } 
}
 
Your application contains a Web form with a Label control named lblPrice.
You use a StringReader variable named xmlStream to access the following XML fragment.
 
    35 
 
You need to display the price of the product from the XML fragment in the lblPrice Label control.
Which code segment should you use?
 
A.DataTable dt = new DataTable(); dt.ExtendedProperties.Add("Type", "Product"); 
dt.ReadXml(xmlStream); 
lblPrice.Text = dt.Rows[0]["Price"].ToString();
B.XmlReader xr = XmlReader.Create(xmlStream); 
Product boughtProduct = xr.ReadContentAs(typeof(Product), null) as Product; 
lblPrice.Text = boughtProduct.Price.ToString();
C.XmlSerializer xs = new XmlSerializer(typeof(Product)); 
Product boughtProduct = xs.Deserialize(xmlStream) as Product; 
lblPrice.Text = boughtProduct.Price.ToString();
D.XmlDocument xDoc = new XmlDocument(); xDoc.Load(xmlStream); 
Product boughtProduct = xDoc.OfType().First(); 
lblPrice.Text = boughtProduct.Price.ToString();

Answer: C
 

相关内容

热门资讯

2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试必备经典试题8
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试必备经典试题6
微软认证考试基于.NET的We... 微软认证考试基于.NET的Web应用程序开发模拟试题四
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试必备经典试题4
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试必备经典试题5
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试必备经典试题10
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试经典试题2
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试经典试题7
2012年微软认证考试备考模拟... 2012年微软认证考试备考模拟试题5
2014年微软认证:微软认证V... 2014年微软认证:微软认证Version:V2.38考试经典试题1