a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 172|回复: 1

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

[复制链接]
发表于 2012-8-3 00:09:22 | 显示全部楼层 |阅读模式
第 16 题   
8 W3 K- G- t; p* h% {4 k7 Q你正在写一个应用。它利用  SOAP  去和其他应用交换数据。你使用一个从  ArrayList  继承的  2 M7 R' S. M1 c6 n
Department 类作为数据对象发送给另一个应用。Department 被命名为 dept。为了通过 SOAP  8 F" j& q# [7 m2 {4 p
进行传送,你需要保证 Department 对象被序列化。你应该使用下面那个代码进行 dept 的序列  
- [: g5 b6 @$ _4 k# D; d化?  
' p) o# D: P& d6 \6 m) E, s, U6 Y% ZA. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new  
; s# w; a5 P, J( ^7 Ibyte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer); foreach  , R$ p! n5 H2 j9 T
(object o in dept) {formatter.Serialize(stream, o);}  : m% z5 t7 W( |+ [/ ^1 L' B) ?
B. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new  ; C' T# I/ \0 }3 K' B2 k
byte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer);  
8 h7 y: w' @4 e0 K2 A. x- Nformatter.Serialize(stream, dept);  ; Z4 x1 }- h1 b' Y  d" K: y& z% T
C. SoapFormatter formatter = new SoapFormatter();MemoryStream stream = new  
, w5 H- y0 Q1 f% AMemoryStream();foreach (object o in dept) {  8 E6 T' {- L% l0 A0 a
Formatter.Serialize(stream, o);}  6 |& F9 a' l/ R+ w) b, {8 z
D. SoapFormatter formatter = new SoapFormatter();MemoryStream stream = new  1 n! r1 A2 E5 R
MemoryStream(); formatter.Serialize(stream, dept);  
0 ~- J* y, h7 U6 l2 R答案: D  $ K; g. F% {; K) ?$ g# J
+ B0 H7 r) y! c' G8 L/ ?, W
第 17 题     l/ e5 s3 g% i$ n8 f
你需要写一个完成如下任务的代码段:  $ ]+ y1 `) i! B0 T& r
1) 查找所有暂停的服务  ' J' Y$ @5 q% ^9 B0 J0 y
2) 把服务的显示名称增加到集合中  
* R1 {) t( W  h请问,你应该使用那个代码段?  & D& @8 S+ a  ]8 Y2 [
A. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher( _  - V, E1 ~: H. F' q
"Select * from Win32_Service where State = ’Paused’")  
2 _7 |/ H5 P/ `, U& L0 J7 }For Each svc As  
% V' F4 ]  X1 h. f' }ManagementObject In searcher.Get()  5 ^( a" L$ t2 E& O
Collection1.Add(svc("DisplayName"))  7 a  ~  ^# o8 z' D# l, z8 x
Next  
: [! Z" ~: S- N- |; g1 @) a) @( M' BB. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher ( _  ) z9 L7 ?. O6 x
"Select * from Win32_Service", "State = ’Paused’")  
8 }& h8 U5 x4 g" Y/ XFor Each svc As ManagementObject      In searcher.Get()  
" V* @! ?% [4 V" UCollection1.Add(svc("DisplayName"))  ( V, M1 q$ i" z5 \. G
Next  
" B7 K& G: t9 ^5 @; d: Y9 c- UC. Dim searcher As ManagementObjectSearcher = _ New ManagementObjectSearcher( _  
! i+ v$ f2 d% w1 r* O"Select * from Win32_Service")  1 k( ?0 N, g. u% ^5 J  P' t
For Each svc As ManagementObject In searcher.Get()  ! g9 B4 W, Q0 l8 S# g0 N5 v
If svc("State").ToString() = "’Paused’" Then  
7 {/ C) V# @9 m9 m- MCollection1.Add(svc("DisplayName"))  
( Y. b7 u& v; i0 P! i9 E- r" zEnd If  
: {( M( ~5 s# Z4 VNext  
8 H% f$ y% }* i' p0 SD. Dim searcher As New ManagementObjectSearcher()searcher.Scope = New  1 Y4 [$ w( X" ]2 ?$ \& P& O
ManagementScope("Win32_Service")  4 i! m+ C9 [+ m1 |% _: _
For Each svc As ManagementObject In    searcher.Get()  - H: a' s5 X3 k: W# x/ D% D  K2 A
If svc("State").ToString() = "Paused" Then  
) N; X/ G% \" f1 n/ W6 TCollection1.Add(svc("DisplayName"))  
) F! ~4 y) x* h: }/ u: ^End If  
( c& ]0 n; s& x- f. O% |# ], uNext  ( a/ I' @/ d: w' ~9 ^
答案: A  3 H: B. [# O# x6 S
4 N0 s& W+ C; E4 K+ m) z$ [* J
第 18 题  $ W- U" L' j/ B& l6 ~4 }6 R1 u9 }$ L
你正在写一个接收字符串参数 message 的方法。你的方法必须截取 message 参数为单独的  
4 W6 M1 c' W( R7 K文本行并且传递每一行给另一个方法 Process。你应该使用那个代码段?  7 a5 J( _) G9 h! X- Q, Y
A. Dim reader As New  & X# `' P. c$ u% S
StringReader(message)ProcessMessage(reader.ReadToEnd())reader.Close()  
7 Y7 h; y, m, {* _6 N8 fB. Dim reader As New StringReader(message)While reader.Peek()  -1  
: M+ t/ Z: O  J+ S( }2 k, uDim line as String = reader.Read().ToString()  
1 |) ?, ^! }, O& |  }ProcessMessage(line)End Whilereader.Close()  
6 T* P: u% K7 s1 n- @$ X5 ~. ~, pC. Dim reader As New  " J. {0 Y6 U; l  D
StringReader(message)ProcessMessage(reader.ToString())reader.Close()  
- D9 i" t2 j. K) r9 XD. Dim reader As New StringReader(message)While reader.Peek()  -1  
- t5 n, |* V: t% C) QProcessMessage(reader.ReadLine())End Whilereader.Close()  
' H% ^3 Z' O7 S$ d9 C答案: D
回复

使用道具 举报

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

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

第 19 题   
8 L6 B0 ?7 U/ \1 G你需要创建一个能够和 COM 进行互操作的类。为此,你需要保证 COM 应用能够创建这个  
) q# [) y. r1 w( m8 M类的实例并且能够调用 GetAddress 方法。你应该使用那个代码段定义你的类?  
$ K6 \  N9 P1 @! B# n4 R; }0 ZA. public class Customer {  , o5 V& b$ b& j7 i0 I; N2 b9 ]
string addressString;  ) c5 K2 g5 e4 G6 E
public Customer(string address) { addressString = address; }  
2 X9 r7 l$ u1 D. w; Ypublic string GetAddress() { return addressString; }}  7 B) e' @5 ?* Q7 h3 z7 E1 J
B. public class Customer {  * g. z7 h6 D5 C. f& E6 f
static string addressString;  
( C0 f3 s1 ^0 [public Customer() { }  , K8 E, p9 u- A& e7 a! W" ]/ b, K
public static string GetAddress() { return addressString; }}  
% c! T  N& ^7 w1 b  PC. public class Customer {  
' h+ ^/ ~  T! A% Jstring addressString;  
  z8 C& U9 @9 I; P1 mpublic Customer() { }  8 `. `% N& q" v% Z3 i
public string GetAddress() { return addressString; }}  
  V) w& I6 [" H' O1 H) {D. public class Customer {  - I+ @/ Q+ G( [
string addressString;  * I- |' X$ H  W: |* L; W$ N
public Customer() { }  $ [0 Q' ^5 C1 g' O4 ]+ ^4 K* F
internal string GetAddress() { return addressString; }}  ! W, D( R$ s2 t: f2 r
答案: C  
5 K: C1 f, U8 n4 e' w
2 q0 V1 u+ m# t3 H0 p$ O2 M第 20 题   
% v. Y2 y9 Q3 X3 a% I9 ?5 u你正在开发一个类库。你的代码需要访问系统环境变量。对于未给调用堆栈中处于较高位置  6 I$ \* Y6 O  p
的所有调用方授予当前实例所指定的权限,则在运行时强制  SecurityException。你应该调用  5 W( r* ^. i2 u% K
那个方法?  + y: E7 [% p2 o, X; g/ i; p" I
A. set.Demand();  $ a7 D& L2 z$ R2 j
B. set.Assert();  ' C2 V: E" K& Y: F! @0 q$ I) s
C. set.PermitOnly();  
$ \. A% l* K8 D4 CD. set.Deny();  
5 C. b5 a: o% M答案: A
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 04:56 , Processed in 0.788317 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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