第 46 题 ( Y% p$ c2 |9 B
你创建了一个发送 e-mail 的应用。一个名称为 smtp.Company.com 的 SMTP 服务器在本地子 M r$ K4 n- a' b0 o- C" O3 ^5 p
网 是 可 用 的 。 为 了 测 试 应 用 , 你 使 用 源 地 址 为 me@Company.com , 目 标 地 址 为 3 [. r% E! C% P4 J6 D( V4 A
you@Company.com。你应该使用下面那个代码段去发送 e-mail? ( `6 i! t0 L$ O8 ~; w# ^+ u
. ]2 ?# o, k E' g5 OA. Dim MailFrom As New MailAddress("me@Company.com", "Me") ( h1 i" E; h, W. [
Dim MailTo As New MailAddress("you@Company.com", "You") ' p& Z" g& k! B, @; z
Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject =
' k- j) C* t- b3 A! ~/ p"Greetings"Message.Body = "Test"Message.Dispose() 6 G6 |' v- X3 q" k H4 G/ d9 D
B. Dim SMTPClient As String = "smtp.Company.com"
* P" n+ P& d+ |# P, n9 o) gDim MailFrom As String = me@Company.com ( x4 }* Z* Q* ?
Dim MailTo As String = you@Company.com ! Y7 h, B9 O7 e' f
Dim Subject As String = "Greetings" " N- m2 W+ k( P) [( h
Dim Body As String = "Test"Dim Message As New MailMessage(MailFrom, MailTo, # ]% n) T3 Q1 Y: \% f. E8 Y
Subject, SMTPClient) % c9 j6 t$ H- x* j, i; `9 J
C. Dim MailFrom As New MailAddress("me@Company.com", "Me")
9 j& ^% ~& f& |+ O) `# LDim MailTo As New MailAddress("you@Company.com", "You")
: ]: ^6 v. c. @+ gDim Message As New MailMessage(MailFrom, MailTo)Message.Subject = 8 c6 Z8 N( W A! s
"Greetings"Message.Body = "Test" # X/ @9 d/ N% w
Dim objClient As New SmtpClient("smtp.Company.com")objClient.Send(Message) + |0 H% T* \# k% T5 @) @- _
D. Dim MailFrom As New MailAddress("me@Company.com", "Me")
/ |, l8 d2 M- _" L& QDim MailTo As New MailAddress("you@Company.com", "You") 5 u _; n4 H, j: y5 S7 M
Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject =
# ?+ M2 A7 K, I8 D) _, {7 s. O5 s; c"Greetings"Message.Body = "Test"
* B2 ^# T) @$ b. JDim Info As New SocketInformationDim Client As New Socket(Info)
: E& S" {1 H& D1 ~3 @Dim Enc As New ASCIIEncodingDim Bytes() As Byte =
7 i9 u: S8 [) _; V; I4 cEnc.GetBytes(Message.ToString)Client.Send(Bytes) * W, X. g+ d: w' B& M
答案: C
0 _, D# K+ Z! f
; @) t# F9 t; ]9 b第 47 题
0 d1 a7 ?/ t9 p* x& m, s) B你需要写一个代码段,从一个流变量 stream1 截取开始的 80 个字节到一个新的字节数组
# }3 R+ F: ?/ i( `" l* lbyteArray 中。你同时也需要保证代码段把截取的字节数保存到一个整型变量 bytesTransferred 2 V+ s) ~4 j, `2 y, o: e
中,你应该使用下面那个代码段? g0 Z3 E2 q) v% T8 Z5 F! ^, u
A. bytesTransferred = stream1.Read(byteArray, 0, 80); / c! `. ~6 u7 @/ A6 {* s- \$ j( i
B. for (int i = 0; i < 80; i++) {
9 Y% O1 w+ I9 }7 lstream1.WriteByte(byteArray); 9 K% _) L5 _4 H+ X S% K6 x
bytesTransferred = i;
M; |( P1 r. `9 u5 C5 ]5 T: vif (!stream1.CanWrite) {
7 z3 o- f- w, D# }' R7 Dbreak; T) e2 R' w4 x" ~7 h' |
}} 0 E1 C6 _; b5 X# B! j
C. while (bytesTransferred < 80) { 8 J: h# p, t; g- P
stream1.Seek(1, SeekOrigin.Current); . z* C: C* L/ w$ C$ U
byteArray[bytesTransferred++] =
2 c+ L( F0 ]; i6 |+ x" J! DConvert.ToByte(stream1.ReadByte());}
2 I Z$ j5 N/ O7 Y, nD. stream1.Write(byteArray, 0, 80);bytesTransferred = byteArray.Length;
8 Y2 g% N8 Y# W9 B, e. T: _答案: A & W7 _( G6 ]9 p, S; C
1 R5 \8 F4 [. E8 |! O/ A! v: ?第 48 题
# e/ E# j& C4 @4 h. S7 f& i你正在创建一个存储不同地域的客户信息的应用。你为这个应用开发了一个内部的测试版本。
9 W, H8 U7 l- u& c# j你需要收集加拿大客户的区域信息,你应该使用那个代码段?
* r$ Z8 |! n. \7 V4 T$ E' |1 MA. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
- }+ j7 G: F! [; t0 H{ //Output the region information...}
* z7 p: s% @9 TB. CultureInfo cultureInfo = new CultureInfo("CA"); // Output the region information¼ 3 V" Q$ U- {$ G% u# ^
C. RegionInfo regionInfo = new RegionInfo("CA"); // Output the region information¼ ' w! r9 U+ r" Z3 X. s
D. RegionInfo regionInfo = new RegionInfo("");if(regionInfo.Name == "CA") { / i, z+ \- g9 S5 x' Y; M: `. O0 |
// Output the region information...} |