2013微軟認(rèn)證考試練習(xí)題及答案(19)

字號:

為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(19)》供大家參考,希望對大家有所幫助?。?!
    QUESTION 11 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 when you click the Button1 control, a selected list of items move from the ListBox1 control to the ListBox2 control. Which code segment should you use? A.foreach (ListItem li in ListBox1.Items) { if (li.Selected) { ListBox2.Items.Add(li); ListBox1.Items.Remove(li); } } B.foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); ListBox1.Items.Remove(li); } } C.foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); } } D.foreach (ListItem li in ListBox2.Items) { if (ListBox1.Items.Contains(li)) ListBox1.Items.Remove(li); } E.foreach (ListItem li in ListBox1.Items) { if (li.Selected) { ListBox1.Items.Remove(li); } } F.foreach (ListItem li in ListBox1.Items) { if (ListBox2.Items.Contains(li)) ListBox1.Items.Remove(li); }
    Answer: CD QUESTION 12 You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. 1 2 3 You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View controls. You need to ensure that you can select the View controls by using the DropDownList1 DropDownList control. Which code segment should you use? A.int idx = DropDownList1.SelectedIndex; MultiView1.ActiveViewIndex = idx; B.int idx = DropDownList1.SelectedIndex; MultiView1.Views[idx].Visible = true; C.int idx = int.Parse(DropDownList1.SelectedValue); MultiView1.ActiveViewIndex = idx; D.int idx = int.Parse(DropDownList1.SelectedValue); MultiView1.Views[idx].Visible = true;
    Answer: A QUESTION 13 You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. To add a Calendar server control to a Web page, you write the following code fragment. You need to disable the non-week days in the Calendar control. What should you do? A.Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { Day.IsSelectable = false; } B.Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { if (Calendar1.SelectedDates.Contains(e.Day.Date)) Calendar1.SelectedDates.Remove(e.Day.Date); } C.Add the following code segment to the Calendar1 SelectionChanged event handler. List list = new List(); foreach (DateTime st in (sender as Calendar).SelectedDates) { if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) { list.Add(st); } } foreach (DateTime dt in list) { (sender as Calendar).SelectedDates.Remove(dt); } D.Add the following code segment to the Calendar1 DataBinding event handler. List list = new List(); foreach (DateTime st in (sender as Calendar).SelectedDates) { if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) { list.Add(st); } } foreach (DateTime dt in list) { (sender as Calendar).SelectedDates.Remove(dt); } Answer: A 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 QUESTION 15 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