会计考友 发表于 2012-8-3 00:09:22

2012年微软认证考试模拟试题及答案1

第 1 题      
你正在开发一个自定义事件处理去自动打印所有打开的文档。事件处理可以指定要打印的份   
数。为此,你需要开发一个传递给事件处理程序的自定义事件参数类,你应该使用下面那个   
代码段?   
A. public class PrintingArgs {   
private int copies;   
public PrintingArgs(int numberOfCopies) {   
this.copies = numberOfCopies;   
}   
public int Copies {   
get { return this.copies; }   
}}   
B. public class PrintingArgs : EventArgs {   
private int copies;   
public PrintingArgs(int numberOfCopies) {   
this.copies = numberOfCopies;   
}   
public int Copies {   
get { return this.copies; }   
}}   
C. public class PrintingArgs {   
private EventArgs eventArgs;   
public PrintingArgs(EventArgs ea) {   
this.eventArgs = ea;   
}public EventArgs Args {get { return eventArgs; }}}   
D. public class PrintingArgs : EventArgs {   
private int copies;}   
答案: B   
   

第 2 题   
你使用反射(Reflection)来获得方法 MyMethod 的信息。你需要获取 MyMethod 方法是否在   
派生类中可以访问,你应该如何做?   
A.访问MethodInfo的IsAssembly属性。   
B.访问MethodInfo的IsVirtual属性。   
C.访问MethodInfo的IsStatic属性。   
D.访问MethodInfo的IsFamily属性。   
答案: D

第 3 题   
你正在创建一个使用非托管资源的类。这个类引用了使用托管资源的对象。你需要确保使用   
这个类的用户在不需要类实例的时候能够够释放资源。你应该做那三个工作?   
(每个答案是解决方案的一部分)   
A.定义一个从WeakReference继承的类。   
B.定义一个实现IDisposable接口的类。   
C.创建一个类析构函数,调用其它对象的方法去释放托管资源。   
D.创建一个类析构函数,释放非托管资源   
E.创建一个Dispose方法,调用System.GC.Collect强制垃圾回收。   
F.创建一个Dispose方法,释放非托管资源并且调用其它对象的方法释放托管资源。   
答案: B, D, F

会计考友 发表于 2012-8-3 00:09:23

2012年微软认证考试模拟试题及答案1

第4 题   
你正对一个应用进行调试。你需要找到引起异常的代码行。请问,Exception类的哪个属性   
能达到这个目的?   
A. Data   
B. Message   
C. StackTrace   
D. Source   
答案: C   

第 5 题   
你正在测试一个新开发的方法 PersistToDB。这个方法接收一个类型为 EventLogEntry 的参数,   
方法没有返回值。你需要创建一段代码来帮助你测试这个方法。这段代码必须从本地计算机的应   
用日志读取日志项然后传递日志项给 PersistToDB 方法。要求,传递到 PersistToDB 方法的日   
志项必须是 MySource 源而且类型为错误或警告的日志。你应该使用下面那个代码段?   
A. EventLog myLog = new EventLog("Application", ".");   
foreach (EventLogEntry entry in myLog.Entries)   
{   
if (entry.Source == "MySource")   
{   
PersistToDB(entry);   
}   
}   
B. EventLog myLog = new EventLog("Application", ".");   
myLog.Source = "MySource";   
foreach (EventLogEntry entry in myLog.Entries)   
{   
if (entry.EntryType == (EventLogEntryType.Error &   
EventLogEntryType.Warning))   
{   
PersistToDB(entry);   
}   
}   
C. EventLog myLog = new EventLog("Application", ".");   
foreach (EventLogEntry entry in myLog.Entries)   
{   
if (entry.Source == "MySource")   
{   
if (entry.EntryType == EventLogEntryType.Error ||entry.EntryType ==   
EventLogEntryType.Warning)   
{   
PersistToDB(entry);   
}   
}   
}   
D. EventLog myLog = new EventLog("Application", ".");   
myLog.Source = "MySource";   
foreach (EventLogEntry entry in myLog.Entries)   
{   
if (entry.EntryType == EventLogEntryType.Error ||   
entry.EntryType == EventLogEntryType.Warning)   
{   
PersistToDB(entry);   
}   
答案: C
页: [1]
查看完整版本: 2012年微软认证考试模拟试题及答案1