2013微軟認(rèn)證考試練習(xí)題及答案(4)

字號:

為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(4)》供大家參考,希望對大家有所幫助?。。?BR>    第 16 題
    你正在寫一個應(yīng)用。它利用 SOAP 去和其他應(yīng)用交換數(shù)據(jù)。你使用一個從 ArrayList 繼承的
    Department 類作為數(shù)據(jù)對象發(fā)送給另一個應(yīng)用。Department 被命名為 dept。為了通過 SOAP
    進(jìn)行傳送,你需要保證 Department 對象被序列化。你應(yīng)該使用下面那個代碼進(jìn)行 dept 的序列
    化?
    A. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new
    byte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer); foreach
    (object o in dept) {formatter.Serialize(stream, o);}
    B. SoapFormatter formatter = new SoapFormatter();byte[] buffer = new
    byte[dept.Capacity];MemoryStream stream = new MemoryStream(buffer);
    formatter.Serialize(stream, dept);
    C. SoapFormatter formatter = new SoapFormatter();MemoryStream stream = new
    MemoryStream();foreach (object o in dept) {
    Formatter.Serialize(stream, o);}
    D. SoapFormatter formatter = new SoapFormatter();MemoryStream stream = new
    MemoryStream(); formatter.Serialize(stream, dept);
    答案: D
    第 17 題
    你需要寫一個完成如下任務(wù)的代碼段:
    1) 查找所有暫停的服務(wù)
    2) 把服務(wù)的顯示名稱增加到集合中
    請問,你應(yīng)該使用那個代碼段?
    A. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher( _
    "Select * from Win32_Service where State = ’Paused’")
    For Each svc As
    ManagementObject In searcher.Get()
    Collection1.Add(svc("DisplayName"))
    Next
    B. Dim searcher As ManagementObjectSearcher = _New ManagementObjectSearcher ( _
    "Select * from Win32_Service", "State = ’Paused’")
    For Each svc As ManagementObject In searcher.Get()
    Collection1.Add(svc("DisplayName"))
    Next
    C. Dim searcher As ManagementObjectSearcher = _ New ManagementObjectSearcher( _
    "Select * from Win32_Service")
    For Each svc As ManagementObject In searcher.Get()
    If svc("State").ToString() = "’Paused’" Then
    Collection1.Add(svc("DisplayName"))
    End If
    Next
    D. Dim searcher As New ManagementObjectSearcher()searcher.Scope = New
    ManagementScope("Win32_Service")
    For Each svc As ManagementObject In searcher.Get()
    If svc("State").ToString() = "Paused" Then
    Collection1.Add(svc("DisplayName"))
    End If
    Next
    答案: A
    第 18 題
    你正在寫一個接收字符串參數(shù) message 的方法。你的方法必須截取 message 參數(shù)為單獨(dú)的
    文本行并且傳遞每一行給另一個方法 Process。你應(yīng)該使用那個代碼段?
    A. Dim reader As New
    StringReader(message)ProcessMessage(reader.ReadToEnd())reader.Close()
    B. Dim reader As New StringReader(message)While reader.Peek() <> -1
    Dim line as String = reader.Read().ToString()
    ProcessMessage(line)End Whilereader.Close()
    C. Dim reader As New
    StringReader(message)ProcessMessage(reader.ToString())reader.Close()
    D. Dim reader As New StringReader(message)While reader.Peek() <> -1
    ProcessMessage(reader.ReadLine())End Whilereader.Close()
    答案: D
    第 19 題
    你需要創(chuàng)建一個能夠和 COM 進(jìn)行互操作的類。為此,你需要保證 COM 應(yīng)用能夠創(chuàng)建這個
    類的實(shí)例并且能夠調(diào)用 GetAddress 方法。你應(yīng)該使用那個代碼段定義你的類?
    A. public class Customer {
    string addressString;
    public Customer(string address) { addressString = address; }
    public string GetAddress() { return addressString; }}
    B. public class Customer {
    static string addressString;
    public Customer() { }
    public static string GetAddress() { return addressString; }}
    C. public class Customer {
    string addressString;
    public Customer() { }
    public string GetAddress() { return addressString; }}
    D. public class Customer {
    string addressString;
    public Customer() { }
    internal string GetAddress() { return addressString; }}
    答案: C
    第 20 題
    你正在開發(fā)一個類庫。你的代碼需要訪問系統(tǒng)環(huán)境變量。對于未給調(diào)用堆棧中處于較高位置
    的所有調(diào)用方授予當(dāng)前實(shí)例所指定的權(quán)限,則在運(yùn)行時強(qiáng)制 SecurityException。你應(yīng)該調(diào)用
    那個方法?
    A. set.Demand();
    B. set.Assert();
    C. set.PermitOnly();
    D. set.Deny();
    答案: A