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

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

第 26 题   
请使用下面的条件确定一个类型:   
1) 是一个数字。   
2) 不大于 65,535   
请问,是哪一个类型?   
A. System.UInt16   
B. int   
C. System.String   
D. System.IntPtr   
答案: A

第 27 题   
你正在写用户验证和授权的代码。username, password,和roles存储在你的应用数据存储区。   
你需要建立一个用于授权检查的用户安全上下文,例如IsInRole。你写如下的代码段去验证用户:   
if (!TestPassword(userName, password))   
throw new Exception("could not authenticate user");   
String[] userRolesArray =LookupUserRoles(userName);   
你需要完成这段代码从而为用户建立安全上下文。你应该使用那个代码段?   
A.   GenericIdentity ident = new GenericIdentity(userName);   
GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray);   
Thread.CurrentPrincipal = currentUser;   
B. WindowsIdentity ident = new WindowsIdentity(userName);WindowsPrincipal currentUser =   
new WindowsPrincipal(ident);Thread.CurrentPrincipal = currentUser;   
C. NTAccount userNTName = new NTAccount(userName);GenericIdentity ident = new   
GenericIdentity(userNTName.Value);GenericPrincipal currentUser= new   
GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser;   
D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(username,   
encryptedPassword);WindowsImpersonationContext ctx =   
WindowsIdentity.Impersonate(token);   
答案: A   

第 28 题   
你正在为一个 Hong Kong 的客户开发一个应用。你需要为本地的货币显示一个符号。你应该使   
用那段代码?   
A. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat;   
culture.NumberNegativePattern = 1; return numberToPrint.ToString("C", culture);   
B. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat;   
culture.CurrencyNegativePattern = 1; return numberToPrint.ToString("C", culture);   
C. CultureInfo culture = new CultureInfo("zh-HK");return numberToPrint.ToString("-(0)",   
culture);   
D. CultureInfo culture = new CultureInfo("zh-HK"); return numberToPrint.ToString("()", culture);   
答案: B

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

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

第 29 题   
你正在开发一个将执行数学计算的应用。你需要确保应用能够同时的执行多个计算。你应该   
怎么做?   
A.设置ProcessThread对象的IdealProcessor属性。   
B.设置ProcessThread对象的ProcessorAffinity属性。   
C.使用for each进行计算;调用ThreadPool的QueueUserWorkItem方法。   
D.设置Process.GetCurrentProcess().BasePriority为High.   
答案: C   

第 30 题   
你正在开发一个名为 PollingService 的服务,这个服务定期的调用一些需要长时间运行的过程。   
这些过程被 DoWork 方法调用。你的服务代码如下:   
ref class PollingService : public ServiceBase {   
public :   
static bool blnExit = false;   
protected :   
override void OnStart(String^ args) {   
do {   
DoWork();   
} while (!blnExit);   
}   
override void OnStop() {   
blnExit = true;   
}   
private :   
void DoWork() {} };   
当你试图去启动服务的时候,你收到一个错误:在本地计算机上不能启动PollingService服务。   
Error 1053:服务不响应启动或控制。你需要去修改服务代码,使服务能够被正确启动。你应该   
如何做?   
A.把循环代码从OnStart方法移动到服务类的构造函数中。   
B.在服务的设计界面拖入一个timer组件。把调用长运行时间过程的代码从OnStart方法移动到   
timer的Tick事件中。在OnStart方法中设置timer的Enabled属性为True,并且调用timer的Start   
方法。   
C.给服务类增加一个类级别的System.Timers.Timer变量。然后在timer的Elapsed事件中调用   
DoWork方法。在OnStart方法中设置timer的Enabled属性为True,并且调用timer的Start方法。   
D.把循环代码从OnStart方法移动到DoWork方法中。   
答案: C
页: [1]
查看完整版本: 2012年微软认证考试模拟试题及答案6