没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
1. You are working on a debug build of an application.
您正在调试一个应用程序
You need to find the line of code that caused an exception to be thrown.
您要找到导致异常被抛出的那行代码
Which property of the Exception class should you use to achieve this goal?
下面异常类的哪一个属性可以用来实现这一目的。
A. Data
B. Message
C. StackTrace
D. Source
Answer: C
2. You are writing a method that returns an ArrayList named al.
您正在编写一个返回 ArrayList 类型值 a1 的方法。
You need to ensure that changes to the ArrayList are performed in a thread-safe manner.
您需要确保 ArrayList 的改变在一个线程安全的方式下进行。
Which code segment should you use?
您可以使用下面哪一段代码
A. ArrayList al = new ArrayList();
lock (al.SyncRoot)
{
return al;
}
B. ArrayList al = new ArrayList();
lock (al.SyncRoot.GetType())
{
return al;
}
C. ArrayList al = new ArrayList();
Monitor.Enter(al);
Monitor.Exit(al);
return al;
D. ArrayList al = new ArrayList();
ArrayList sync_al = ArrayList.Synchronized(al);
return sync_al;
Answer: D
3. You need to create a method to clear a Queue named q.
您需要创建一个用于清除名称为 q 的队列
Which code segment should you use?
下面的那一段代码您可以使用?
A. foreach (object e in q) {
q.Dequeue(); }
B. foreach (object e in q) {
Enqueue(null); }
C. q.Clear();
D. q.Dequeue();
Answer: C
4. You are creating a class to compare a specially-formatted string.
您正在创建一个用于比较特殊格式字符串的类
The default collation comparisons do not apply.
原有默认的排序比较不能够适用。
You need to implement the IComparable<string> interface.
您需要实现 IComparable<string>接口
Which code segment should you use?
下面的那一段代码您可以使用?
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
5. You are writing a custom dictionary. The custom-dictionary class is named MyDictionary.
您正在编写一个自定义的字典类。此自定义的字典类被命名为 MyDictionary
You need to ensure that the dictionary is type safe.
您必须确认这个字典类是类型安全的。
Which code segment should you use?
下面的那一段代码您可以使用?
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
6. You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionality
您正在创建一个保存修改数据的用于撤销操作的缓冲区。 您必须确保撤销功能首先
undoes the most recent data modifications first. You also need to ensure that the undo buffer permits the storage
送回最近一次修 改的数据。 您还需要确认此撤销缓冲区只能保存字符串类型数据
of strings only. Which code segment should you use?
下面的那一段代码您可以使用?
A. Stack<string> undoBuffer = new Stack<string>();
B. Stack undoBuffer = new Stack();
C. Queue<string> undoBuffer = new Queue<string>();
D. Queue undoBuffer = new Queue();
Answer: A
7. You are developing an application to assist the user in conducting electronic surveys. The survey consists of 25
您正在开发一个用于协助用户进行电子调查的应用程序。 这项调查包含 25
true-or-false questions. You need to perform the following tasks: Initialize each answer to true. Minimize the
个真实或虚假的问题。您需要执行下列任务: 初始化每一个答案的值为 true。并且使
amount of memory used by each survey.
每个答案的内存使用量最少。
Which storage option should you choose?
您将使用那种存储方案?
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
8. You are creating a class named Age. You need to ensure that the Age class is written such that collections of
您正在创建一个名为 Age 的类。 你必须确保保存在集合中的 Age 类对象
Age objects can be sorted.
可以进行排序。
Which code segment should you use?
下面哪段代码您可以使用
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
9. You are developing a custom event handler to automatically print all open documents. The event handler helps
您正在开发一个自定义事件处理 能够自动打印所有打开的文件。 该事件处理程序有助于
specify the number of copies to be printed. You need to develop a custom event arguments class to pass as a
指定的打印的份数。 您需要自定义一个类,其对象可以作为一个参数
parameter to the event handler.
传递给事件处理程序。
Which code segment should you use?
下面哪段代码可以使用?
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
10. You write the following code. public delegate void FaxDocs(object sender, FaxArgs args);
您写了下面的代码
You need to create an event that will invoke FaxDocs.
您需要创建一个事件来调用 FaxDocs 函数
Which code segment should you use?
下面哪段代码可以使用?
A. public static event FaxDocs Fax;
B. public static event Fax FaxDocs;
C. public class FaxArgs : EventArgs {
private string coverPageInfo;
public FaxArgs(string coverInfo) {
this.coverPageInfo = coverPageInfo;
}
public string CoverPageInformation {
get {return this.coverPageInfo;} } }
D. public class FaxArgs : EventArgs {
private string coverPageInfo;
public string CoverPageInformation {
get {return this.coverPageInfo;} } }
Answer: A
11. You need to write a multicast delegate that accepts a DateTime argument.
您需要创建一个委托来接受一个 DateTime 类型参数
Which code segment should you use?
下面哪段代码可以使用?
A. public delegate int PowerDeviceOn(bool result,
DateTime autoPowerOff);
B. public delegate bool PowerDeviceOn(object sender,
EventArgs autoPowerOff);
C. public delegate void PowerDeviceOn(DateTime autoPowerOff);
剩余51页未读,继续阅读
EduaskMSQ
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0