没有合适的资源?快使用搜索试试~ 我知道了~
微软C#认证。word版
资源详情
资源评论
资源推荐
1. 您正在编写自定义字典。该自定义字典类名为MyDictionary。
您需要确保该字典是类型安全的字典。
您应该使用哪个代码段?
A. class MyDictionary :Dictionary<string, string>
B. class MyDictionary :HashTable
C. class MyDictionary :IDictionary
D. class MyDictionary { ...}
Dictionary<string, string> t =
new Dictionary<string, string>();
MyDictionary dictionary = (MyDictionary)t;
Answer: A
2. 您正在创建名为Age 的类。
您需要确保编写的Age 类的对象所构成的集合能够被排序。
您应该使用哪个代码段?
A. public class Age {
public int Value;
public object CompareTo(object obj) {
if (obj is Age) {
Age _age = (Age) obj;
return Value.CompareTo(obj);
}
throw new ArgumentException("object not an Age");
}
}
B. public class Age {
public int Value;
public object CompareTo(int iValue) {
try {
return Value.CompareTo(iValue);
} catch {
throw new ArgumentException ("object not an Age");
}
}
}
C. public class Age :IComparable {
public int Value;
public int CompareTo(object obj) {
if (obj is Age) {
Age _age = (Age) obj;
return Value.CompareTo(_age.Value);
}
throw new ArgumentException("object not an Age");
}
}
D. public class Age :IComparable {
public int Value;
public int CompareTo(object obj) {
try {
return Value.CompareTo(((Age) obj).Value);
} catch {
return -1;
}
}
}
Answer: C
3. 您正在创建一个类,用于比较经过特殊格式设置的字符串。默认的排序规则比较不适用。
您需要实现IComparable<string> 接口。
您应该使用哪个代码段?
A. public class Person :IComparable<string>{
public int CompareTo(string other){
...
}
}
B. public class Person :IComparable<string>{
public int CompareTo(object other){
...
}
}
C. public class Person :IComparable<string>{
public bool CompareTo(string other){
...
}
}
D. public class Person :IComparable<string>{
public bool CompareTo(object other){
...
}
}
Answer: A
4. 您正在开发自定义集合类。
您需要在类中创建方法。
您需要确保在类中创建的方法返回与Foreach 语句兼容的类型。
该方法应满足哪个条件?
A. 该方法必须返回IEnumerator 或IEnumerable 类型。
B. 该方法必须返回IComparable 类型。
C. 该方法必须明确包含集合。
D. 该方法必须是类中唯一的迭代器。
Answer: A
5. 您正在开发一个协助用户进行电子调查的应用程序。调查由25 个对错判断题组成。
您需要执行下列任务:
·将每个答案预置为是。
·最大程度地减少每次调查使用的内存量。
您应该选择哪个存储选项?
A. BitVector32 answers = new BitVector32(1);
B. BitVector32 answers = new BitVector32(-1);
C. BitArray answers = new BitArray (1);
D. BitArray answers = new BitArray(-1);
Answer: B
6. 您需要确定满足下列条件的类型:
始终为数字。
不大于65,535。
您应选择哪种类型?
A. System.UInt16
B. int
C. System.String
D. System.IntPtr
Answer: A
7.您正在开发一个自定义事件处理程序,自动打印所有打开的文件。事件处理程序有助于
指定打印的份数。你需要开发一个自定义事件的参数类作为参数传递给事件处理程序。您
应该使用哪个代码段?
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;}
Answer: B
8. 您编写一个名为Employee 的类,该类包含以下代码段。
public class Employee {
string employeeId, employeeName, jobTitleName;
public string GetName() { return employeeName; }
public string GetTitle() { return jobTitleName; }
您需要在类型库中向COM 公开此类。COM 接口还必须便于在Employee 类的新版本之间
保持向前兼容。
您需要选择方法以生成COM 接口。
您应该怎么做?
A. 将以下属性添加到类定义。
[ClassInterface(ClassInterfaceType.None)]
public class Employee {
B. 将以下属性添加到类定义。
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Employee {
C. 将以下属性添加到类定义。
[ComVisible(true)]
public class Employee {
D. 为类定义接口并将以下属性添加到类定义。
[ClassInterface(ClassInterfaceType.None)]
public class Employee :IEmployee {
Answer: D
9. 您需要通过使用平台调用服务从托管代码中调用非托管函数。您应该做些什么?
A.创建一个类支持DLL函数,然后使用托管代码创建原型方法。
B.使用COM注册你的程序集,然后从COM中参考你的托管代码。
C.为托管代码创建一个类库。
D.导入一个类库。然后创建COM对象的实例
Answer: A
10. 您正在写的下面的代码是,调用一个函数从Win32应用程序编程接口( API )通过使
用平台调用。
A. [DllImport("user32")]
public static extern int MessageBox(int hWnd, String text, String caption, uint type);
B. [DllImport("user32")]
public static extern int MessageBoxA(int hWnd,String text, String caption, uint type);
C. [DllImport("user32")]
public static extern int Win32API_User32_MessageBox(int hWnd, String text, String
caption, uint type);
D. [DllImport(@"C. \WINDOWS\system32\user32.dll")]
public static extern int MessageBox(int hWnd, String text, String caption, uint type);
Answer: A
11.您创建了一个应用程序发送邮件的电子邮箱。 在你的本地服务器上有一个有效的SMTP
服务器。SMTP服务器的名称smtp.contoso.com 。要测试应用程序,您使用的源地址是:
me@contoso.com ,并发送信息到目标地址:you@contoso.com 。该代码段应该使用
哪一段?
!"#$%&
$&'&
!"#
$
!
&'
'
!"#
$
&'&'&
%
!"#
$
剩余38页未读,继续阅读
abc123321cba123321
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1