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


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 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);

}
 

相关内容

热门资讯

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