a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 259|回复: 1

[考试试题] 2012年微软认证考试模拟试题及答案12

[复制链接]
发表于 2012-8-3 00:09:22 | 显示全部楼层 |阅读模式
第 56 题  
7 ?7 w8 T) d+ {你正在为一个客户开发一个财务报表。你的客户在美国有总部,在密西哥有分部。你需要保  
+ ^8 x1 T) H& G* z  I& }  t证客户在密西哥产生的报表,则当前的日期格式为 Mexican  Spanish 格式。你应该使用下面  ' [- H# q8 ^) {- f6 u
那个代码段实现?  4 b" z" k5 D0 ^6 A2 ?7 g- H- z
A. DateTimeFormatInfo dtfi = new CultureInfo("es-MX", false).DateTimeFormat;  0 ~; ?1 F+ V: s6 \
DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month,  ( x( x0 `+ v. G/ z) p7 @
DateTime.Today.Day); string dateString = dt.ToString(dtfi.LongDatePattern);  
' Z& b$ Q! Z5 F1 x' U8 KB. Calendar cal = new CultureInfo("es-MX", false).Calendar; DateTime dt = new  
2 x9 x: u; d: ^0 n1 R. vDateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); Strong  0 l. {- c) z0 G: H! j) |* c( v
DateString = dt.ToString();  
4 L/ a  r- u% q6 R9 IC. string dateString = DateTimeFormatInfo.CurrentInfo  
3 f/ i% m4 D+ X( k$ w' x6 B5 BGetMonthName(DateTime.Today.Month);  
5 M4 X, o3 v) H3 J7 q2 H; R* `1 n) U9 ~D.string dateString = DateTime.Today.Month.ToString("es-MX");  5 A1 v3 p% L7 N9 E
答案: A  4 o: k# J: f  B- b7 c
  
+ E2 e! w. J6 s+ A' J第 57 题  5 Q1 }, [' k* X7 S# Z
你正在创建一个应用,它从应用配置文件的自定义节中读取值。XML 自定义节如下:  * ~2 J' T1 d7 A' ^
  * Q9 L2 h; G% P% k
  6 Q' c' g( w8 f# E* v. d
  
" m6 |  {) W( p, @* _3 p) _  + K* t( X  F: R2 |0 }0 S( B( c
  : u, O: U$ |* @1 r3 a# A3 x
你需要写一个代码段去定义一个名为Role  的类。而且你需要保证Role类使用从配置文件自定义  ' h5 K! v. B, }5 \8 |! n
节读取的数据进行初始化。你应该使用下面那个代码段?  
) L* s& k; u* s4 r! {A.   public class Role : ConfigurationElement  - w$ b( d. r  r% n6 U4 l
{  
  b- k  `! u. E1 T  Q+ Ginternal string_ElementName = "name";  5 T" c: i! Q  T2 f+ W6 G; X
[ConfigurationProperty("role")]  ( R( ^4 \, `- {  \+ E
public string Name  
' j! G! R0 r- J% i* K+ f+ K{  
+ K0 _' e* p6 i" ?2 T  Lget  ( f& h/ V# \5 C4 E3 t1 ^
{  : g- q& T8 `# g- L% A
return ((string)base["role"]);  * o; b1 \4 m3 `! w; C! [
}  
+ t) h( B+ V: L( o}  
6 i  [6 C: |5 J& p  z* P  b7 U# \}  ) d" l; s) A7 R
B. public class Role : ConfigurationElement {  # i2 v; w/ z- t
internal string_ElementName = "role";  & z! g( Y, b3 `; J8 z* s
[ConfigurationProperty("name", RequiredValue = true)]  
' v) |( q# _' r; p/ npublic string Name {  # {, \* R% v: }# |
get {  
6 x. s+ F3 \. S+ V1 q! b/ G# y9 ireturn ((string)base["name"]);  
0 {; t0 q8 \% a( ~+ }, o: g6 d% H* W}  
6 b7 ]# G' f# Q- E3 L- X4 ?}    f6 T) [2 d2 R6 [6 \
}  7 ]" V( }: ^! f$ f9 w% m! F+ t
C. public class Role : ConfigurationElement {  
: l5 N: L" r  G& a  \internal string_ElementName = "role";  / }& i6 C4 @1 @) }- F
private String_name;  
8 k# p8 q. b7 M- N& t[ConfigurationProperty("name")]  
- ^( W* }: H0 Q& lpublic string Name {  
! D6 }( J3 n/ C- i% F0 B- o( i! tget {  & y2 i, d" g6 j3 F8 ]$ ?# }3 ~
return_name;  
$ E9 h5 G- p4 l8 X}  
% ]( H" u, h2 ]+ c% X; J}  
& P: `" M9 |8 w}  
1 x# Q1 k0 [9 q( {4 ID. public class Role : ConfigurationElement {  
3 P. z9 i% Q- m2 S1 t" P' {: ^internal string_ElementName = "name";  % p, ~, j3 k9 Y. ^
private String_name;  
& z. J- T( e+ S4 ~[ConfigurationProperty("role", RequiredValue = true)]  
  [; F) P3 w* B) a* L- t9 xpublic string Name {  : j4 a5 N4 P6 |: ]) s5 z; r  B
get {  
/ r! Q% {, b5 q7 H) ^# {return_name;  
# k4 b# ^. r% K- p" Y2 @( K}  5 ~6 n. @& T% D0 f3 D+ L# h6 G6 j
}  
  h$ {- x' [4 {, k; o- x}  1 m/ K. Z6 R6 _2 B
答案: B  9 o- w! w, x! N' \3 t3 I+ [

% d+ t, H; @- l6 k# h- v+ a. K, m% @1 g* U+ l/ Q* r$ X
第 58 题  2 Z) \+ s- u4 A  ?
你需要从你的托管代码使用平台调用服务(platform invoke services)调用一个非托管的函数,  4 j! |7 P. Z" d# r
你应该怎么做?  + K  f6 }6 t' D3 O% I# o! w
A. Create a class to hold DLL functions and then create prototype methods by using managed  
# `% `& z; g' ]7 y* u/ _" Q$ FCode。  9 O" u) L" d- z3 D+ n
B.  注册你的程序集为COM组件然后从COM中引用你的托管代码。  : R" Q6 F0 z$ x# ~4 o( p
C.  为你的托管代码导出类型库。  
4 J- K# r! Z# o7 yD.导入类型库作为一个程序集然后创建COM对象实例。   - d/ u4 _1 E, Y
答案: A
回复

使用道具 举报

 楼主| 发表于 2012-8-3 00:09:23 | 显示全部楼层

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

</p>第 59 题  
+ ]8 H- q% R: _你正在使用 Microsoft Visual Studio 2005 IDE 去检查一个返回字符串的方法。你指定方法的返  , T- O- f% Q- K: `* I. z8 x
回值保存到字符串变量  fName 中。你需要写一个代码段,如果  fName 的值不等于"Company"  6 C+ n' d4 m- m% D
则打印如下的单行文本消息"Test  Failed:"fName。你也同时需要保证,你的代码段并不影响  # U6 p  W# K0 }. h4 q( A% J
或打断应用的执行。你应该使用下面那个代码段?  
. g- f4 ?1 e6 z, E" mA. Debug.Assert(fName == "Company", "Test Failed: ", fName);  0 m0 v1 v; `" J  z
B. Debug.WriteLineIf(fName != "Company", fName, "Test Failed");  
3 f# [+ I* h) pC. if (fName != "Company") {  
* P* z0 p/ X' D0 ^- {! G8 ~Debug.Print("Test Failed: ");  9 M# e/ s* k8 b
Debug.Print(fName);  
! x' p7 L2 M4 b- ?" T}  
9 B3 P7 k3 ~) ]! h" gD. if (fName != "Company") {  . t  d* T* n; K, U& y
Debug.WriteLine("Test Failed: ");  
5 _0 b: H8 @( r# p4 ZDebug.WriteLine(fName);  7 e0 `0 ?0 W1 ~. {# p2 j. W
}  8 h3 v3 d* ]* V. H
答案: B  
: P% O2 y- Z4 W' M" n9 F- O  
; ~6 O! m9 H% t8 h' D6 I第 60 题  0 r4 }" E3 \* `1 P4 R2 M6 \
你正在开发一个使用自定义身份验证和基于角色安全的应用。你需要写一段代码在运行时为  
% b5 w: A1 u  Y$ X* [; |每一个线程指定一个未经过身份验证的标识对象。你可以使用下面那个代码段?  : o) E2 i( i. {0 d3 p: g
A. AppDomain domain =  
, G, I8 X/ [: D% [8 h6 A; C; o$ {+ lAppDomain.CurrentDomain;domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);  7 Z3 S- s9 H6 N  t8 {9 n
B. AppDomain domain = AppDomain.CurrentDomain;domain.SetThreadPrincipal(new  
" ]$ @8 R* K; Z4 F2 K6 yWindowsPrincipal(null));  
: c/ E' n6 S' i0 s# t: @0 @C. AppDomain domain = AppDomain.CurrentDomain;  4 K& Q# K, d# a0 `% S" w
domain.SetAppDomainPolicy(  
* }- n& B) N  h5 FPolicyLevel.CreateAppDomainLevel());  + V$ z' O: |( D
D. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy(  
! _% ^' @( e2 G1 T) ?% I; FPrincipalPolicy.UnauthenticatedPrincipal);   
% r& R& f% H" X. [7 F: E答案: D
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-6-10 15:08 , Processed in 0.186133 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表