a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 206|回复: 1

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

[复制链接]
发表于 2012-8-3 00:09:22 | 显示全部楼层 |阅读模式
第 11 题  + V1 Q; z( F* i) a# L; q
你写了如下一段代码  public delegate void FaxDocs(object sender, FaxArgs args);  5 [' `  g% l; P3 X! F" Z- b) d8 d
你需要创建一个调用FaxDocs的事件,你应该使用那个代码段?   + g( b; Q& B+ l! [4 n. \; H9 O
A. pulic static event FaxDocs Fax;  
  k& }7 ?* c7 rB. public static event Fax FaxDocs;  : a  W$ Q% x9 ]1 i( f
C. public class FaxArgs : EventArgs {  
/ S7 u% O7 U# @: \4 \private string coverPageInfo;  ) F  q. U7 U; x9 E2 l5 Q! ~0 V
public FaxArgs(string coverInfo) {  
" A& e# I. k  p# v0 k, Kthis.coverPageInfo = coverPageInfo;  
. L& v$ n/ u. e1 r0 n  r}  
  n" T# ]9 [9 ?( a7 @$ qpublic string CoverPageInformation {  / n$ a7 f7 W! t0 ]+ E
get {return this.coverPageInfo;}  ( @. g/ p# `) h
}}  
. b. j% }; G/ j6 X0 L* fD. public class FaxArgs : EventArgs {  0 U$ ?/ a" |- ]1 J
private string coverPageInfo;  * A% v4 v6 x9 q
public string CoverPageInformation {  
; u8 m3 T6 l$ A9 gget {return this.coverPageInfo;}  
' Q8 y) O0 ^4 a9 ]6 Z}}  5 a* [; l4 _/ x' W$ P+ W
答案: A  
) J) L+ m2 r: ~7 R& H8 s$ ^3 D  
! c4 ?: J6 |; c  L第 12 题   3 t: _, l( N9 H7 _4 ?' V
你写如下的代码段去调用Win32 Application Programming Interface (API):  
1 Q0 V2 e! g+ X. Nstring personName = "N?el";    b% t" k% r7 V% ^7 i. ~* D
string msg = "Welcome" + personName + "to club"!";  ; G2 M2 {& ~9 d: i
bool rc =User32API.MessageBox(0, msg, personName, 0);  
& y$ X3 G" n$ A. ~( V& X为了实现上面的调用,你需要定义一个方法原型,请问,你会采用那个代码段进行定义?  
$ q1 |# P  A1 S  PA.   [DllImport("user32", CharSet = CharSet.Ansi)]  ! y  L5 R$ g5 S% h9 m- U% ]
public static extern bool MessageBox(int hWnd,String text,String caption,uint type);}  1 }4 B3 K( X! P7 Z" _6 f
B.   [DllImport("user32", EntryPoint = "MessageBoxA", CharSet = CharSet.Ansi)]  
  H# s9 R* `6 E& b. j5 DPublic static extern bool MessageBox(int hWnd,  
8 J! e: s) y& ^% z8 b[MarshalAs(UnmanagedType.LPWStr)]String text,  
+ [& o" c- f  r7 Z; f7 b[MarshalAs(UnmanagedType.LPWStr)]String caption,  
! E1 Z$ i; ^2 L- z, auint type);}  
  W  H- r. b5 j2 b! SC.   [DllImport("user32", CharSet = CharSet.Unicode)]  
* v5 s- o- |+ f9 Z% {7 R/ Dpublic static extern bool MessageBox(int hWnd,String text, String caption,uint type);}  
. s8 D# v/ z0 d9 Y% RD. [DllImport("user32", EntryPoint = "MessageBoxA", CharSet =  ) {( v) `' a8 L8 F$ C) G$ C8 s
CharSet.Unicode)]public static extern bool MessageBox(int hWnd,  & N6 |! }9 K, G5 V( F
[MarshalAs(UnmanagedType.LPWStr)]String text,  
3 V9 S& @: |' f: c- v[MarshalAs(UnmanagedType.LPWStr)]String caption,uint type);}  
# ]! U1 E& u6 F1 _9 G& k7 o% H答案:C  
" e" j  N/ d! `2 a2 U% L+ o0 U0 L6 x) x. R# M8 u
第 13 题   ( a; G- r7 K5 @$ C* x5 H3 E3 z
你需要以字符串的形式返回isolated storage文件内容。已知,文件名称为Settings.dat并且在机  + _; L0 Q0 n: m$ X
器范围内唯一。你应该使用下面那个代码段?  9 ?4 v$ @$ n. V1 u& W( z( Y* M% O
A. IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(  
) _9 N9 M2 }. e4 p3 L"Settings.dat", FileMode.Open); string result = new StreamReader(isoStream).ReadToEnd();  & ?6 R. h" _. T% E+ t
B. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();  $ z9 p8 l6 u4 h* p" }$ v
IsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(  
$ F9 i, e- G# m0 ]3 d"Settings.dat", FileMode.Open, isoFile); string result = new  7 V  k  v2 s5 Z  u+ J* q$ h
StreamReader(isoStream).ReadToEnd();  5 E( M8 X; k8 a
C. IsolatedStorageFileStream isoStream;isoStream = new  
& s5 }( s, E; ]8 [' @6 f  M5 A: ~& kIsolatedStorageFileStream("Settings.dat", FileMode.Open); string result =  
$ F3 q% P2 d# q0 JisoStream.ToString();    x1 O, G% e0 t4 K4 S0 Z
D. IsolatedStorageFile isoFile;isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();  
* q/ i6 ^5 _$ i, D9 ~) yIsolatedStorageFileStream isoStream;isoStream = new IsolatedStorageFileStream(  : {- P- d$ f8 o. x' q. ?
"Settings.dat", FileMode.Open, isoFile); string result = isoStream.ToString();  ; T$ l4 C4 x/ h+ J/ Z
答案: B
回复

使用道具 举报

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

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

第 14 题   
: O, p* c* E! W' g" J+ k你正在写一个压缩字节数组的方法。数组被以 document 作为参数名传递到一个方法。你需  9 N) Y0 j+ G% R
要压缩输入的字节数组并且返回一个字节数组作为结果。你的方法应该使用下面那个代码  
( n, L8 j+ N! A段?  
: |  t/ r0 c- @" ?% w, s7 ~/ a9 oA. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new  + T3 }3 k' Q6 _$ c
DeflateStream(strm,CompressionMode.Compress); byte[] result = new  
- |3 O8 @# {8 e4 o& `byte[document.Length];deflate.Write(result,0, result.Length); return result;  + h- X$ P  Q$ |0 N. f: V
B. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new  
) s  _1 ^" e/ F' ^7 E3 z; ADeflateStream(strm,  
3 K9 U" e9 ^2 C7 LCompressionMode.Comress);deflate.Write(docemtn, 0,  8 x* U3 X( U6 u3 u8 Y2 R, Q
document.Length);deflate.Close();return strm.ToArray();  - {0 Q# H0 z. o0 _1 J# M% N7 L
C. MemoryStream strm = new MemoryStream();DeflateStream deflate = new  ! ^' n  E$ l. M* b* b/ X6 n+ J
DeflateStream(strm, CompressionMode.Compress);deflate.Write(decument, 0,  6 H5 `; Y6 b8 p, i# `
decument.Length);deflate.Close();return strm.ToArray();  4 ^- O3 U; B- a4 {0 U  @" E
D. MemoryStream inStream = new MemoryStream(document);DeflateStream deflate =  ) ]9 z4 \; }  w8 v
new DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream =  6 F  {: a! {$ G1 Z0 Y
new MemoryStream();int b;while ((b = deflate.ReadByte()) ! = -1) {  
, c  r% k- }8 {1 W- voutStream.WriteByte((byte)b);} return outStream.ToArray();  ; m. N) u) Q+ Q* V9 o3 H0 q
答案: C 6 c& F* B& v, m& L
  I+ R' B1 Q( c9 `8 Q0 D. _
第 15 题  
  q* r, n9 x5 Q- b$ c4 U: v你需要选择一个类。它基于Key实现了小集合和大集合的优化。你应该选择下面那一个类?  : ?3 K% P; F" J9 x  Z  s- b) U. ^% u
A. OrderedDictionary class  + q) }, @3 E+ ~7 L+ o. ?
B. HybridDictionary class  0 q5 @3 Y1 S& u! Q! n" n
C. ListDictionary class  
9 k5 a4 C' Q4 A* ]2 ND. Hashtable class  6 a$ }( {  ]2 t7 d
答案: B
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 14:53 , Processed in 0.214941 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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