為大家收集整理了《2013年微軟認證考試_70-562練習3》供大家參考,希望對大家有所幫助!??!
QUESTION 5
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create the following controls:
A composite custom control named MyControl.
A templated custom control named OrderFormData.
You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.)
01 protected override void
02 CreateChildControls() {
03 Controls.Clear();
04 OrderFormData oFData = new
05 OrderFormData("OrderForm");
06
07 }
You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 06?
A.
Template.InstantiateIn(this); this.Controls.Add(oFData);
B.
Template.InstantiateIn(oFData); Controls.Add(oFData);
C.
this.TemplateControl = (TemplateControl)Template; -Can't Remember All-???
oFData.TemplateControl = (TemplateControl)Template;
Controls.Add(oFData);
D.
this.TemplateControl = (TemplateControl)oFData; -Can't Remember All-???
Controls.Add(oFData);
Answer: B
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 5
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create the following controls:
A composite custom control named MyControl.
A templated custom control named OrderFormData.
You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.)
01 protected override void
02 CreateChildControls() {
03 Controls.Clear();
04 OrderFormData oFData = new
05 OrderFormData("OrderForm");
06
07 }
You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 06?
A.
Template.InstantiateIn(this); this.Controls.Add(oFData);
B.
Template.InstantiateIn(oFData); Controls.Add(oFData);
C.
this.TemplateControl = (TemplateControl)Template; -Can't Remember All-???
oFData.TemplateControl = (TemplateControl)Template;
Controls.Add(oFData);
D.
this.TemplateControl = (TemplateControl)oFData; -Can't Remember All-???
Controls.Add(oFData);
Answer: B
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

