2013微軟認證考試練習(xí)題及答案(18)

字號:

為大家收集整理了《2013微軟認證考試練習(xí)題及答案(18)》供大家參考,希望對大家有所幫助?。?!
    QUESTION 6
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You create a composite custom control named MyControl.
    You need to add an instance of the OrderFormData control to the MyControl control.
    Which code segment should you use?
    A.
    protected override void CreateChildControls() {
    Controls.Clear();
    OrderFormData oFData = new OrderFormData("OrderForm");
    Controls.Add(oFData);
    }
    B.
    protected override void RenderContents(HtmlTextWriter writer) {
    OrderFormData oFData = new OrderFormData("OrderForm");
    oFData.RenderControl(writer);
    }
    C.
    protected override void EnsureChildControls() {
    Controls.Clear();
    OrderFormData oFData = new OrderFormData("OrderForm");
    oFData.EnsureChildControls();
    if (!ChildControlsCreated) CreateChildControls();
    }
    D.
    protected override ControlCollection CreateControlCollection() {
    ControlCollection controls = new ControlCollection(this);
    OrderFormData oFData = new OrderFormData("OrderForm");
    controls.Add(oFData);
    return controls;
    }
    Answer: A
    QUESTION 7
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You create a custom control named OrderForm.
    You write the following code segment.
    public delegate void CheckOrderFormEventHandler(EventArgs e); private static readonly object CheckOrderFormKey = new object();
    public event CheckOrderFormEventHandler CheckOrderForm
    {
    add { Events.AddHandler(CheckOrderFormKey, value); }
    remove { Events.RemoveHandler(CheckOrderFormKey, value); }
    }
    You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.
    Which code segment should you use?
    A.
    protected virtual void OnCheckOrderForm(EventArgs e) {
    CheckOrderFormEventHandler checkOrderForm = (CheckOrderFormEventHandler)Events[ typeof(CheckOrderFormEventHandler)];
    if (checkOrderForm != null) checkOrderForm(e); }
    B.
    protected virtual void OnCheckOrderForm(EventArgs e) {
    CheckOrderFormEventHandler checkOrderForm = Events[CheckOrderFormKey] as CheckOrderFormEventHandler;
    if (checkOrderForm != null) checkOrderForm(e); }
    C.
    CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack);
    protected virtual void OnCheckOrderForm(EventArgs e) {
    if (checkOrderForm != null) checkOrderForm(e);
    }
    D.
    CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack);
    protected virtual void OnCheckOrderForm(EventArgs e) {
    if (checkOrderForm != null) RaiseBubbleEvent(checkOrderForm, e);
    }
    Answer: B
    QUESTION 8
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You add a TextBox control named TextBox1.
    You write the following code segment for validation.
    protected void CustomValidator1_ServerValidate( object source, ServerValidateEventArgs args) {
     DateTime dt = String.IsNullOrEmpty(args.Value)
     DateTime.Now : Convert.ToDateTime(args.Value);
     args.IsValid = (DateTime.Now - dt).Days < 10;
    }
    You need to validate the value of TextBox1.
    Which code fragment should you add to the Web page?
    A.
    
    
    B.
    
    ">
    
    C.
    
    ">
    D.
    
    ">
    Answer: A
    QUESTION 9
    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?
    A.
    protected override bool EvaluateIsValid() { string value = GetControlValidationValue( this.Attributes["AssociatedControl"]); bool isValid = Validate(value); return isValid; }
    B.
    protected override bool ControlPropertiesValid() { string value = GetControlValidationValue(this.ValidationGroup); bool isValid = Validate(value); return isValid; }
    C.
    protected override bool EvaluateIsValid() { string value = GetControlValidationValue(this.ControlToValidate); bool isValid = Validate(value); return isValid; }
    D.
    protected override bool ControlPropertiesValid() { string value = GetControlValidationValue( this.Attributes["ControlToValidate"]); bool isValid = Validate(value); this.PropertiesValid = isValid; return true; }
    Answer: C
    QUESTION 10
    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?
    A.
    
    B.
    
    C.
    
    D.
    
    Answer: C