2013年微軟70536認(rèn)證題庫(kù)及答案6

字號(hào):

為大家收集整理了《2013年微軟70536認(rèn)證題庫(kù)及答案6》供大家參考,希望對(duì)大家有所幫助!??!
    25、
    您需要編寫代碼段,用于將名為stream1的流變量的前80個(gè)字節(jié)傳輸?shù)矫麨閎yteArray的新字節(jié)數(shù)組中。您還需要確保代碼段將傳輸?shù)淖止?jié)數(shù)賦值到名為bytesTransferred的整型變量中。
    您應(yīng)該使用哪個(gè)代碼段?
    A.
    bytesTransferred = stream1.Read(byteArray,0, 80);
    B.
    for (int i = 0; i <80; i++) {
    stream1.WriteByte(byteArray[i]);
    bytesTransferred = i;
    if (!stream1.CanWrite) {
    break;
    }
    }
    C.
    while (bytesTransferred< 80) {
    stream1.Seek(1, SeekOrigin.Current);
    byteArray[bytesTransferred++] = Convert.ToByte(stream1.ReadByte()); }
    D.
    stream1.Write(byteArray, 0, 80);
    bytesTransferred = byteArray.Length;
    Answer: A
    Explanation/Reference:
    Explanation: The Read() method accepts a byte array and the start position and number of bytes to read as parameters.
    解釋/參考:
    解釋: read () 方法接受一個(gè)字節(jié)數(shù)組和起始位置和要作為參數(shù)中讀取的字節(jié)數(shù)。
    B & D The question indicates that data should be read from the stream not written to it.
    有關(guān)指示應(yīng)從不寫入流中讀取數(shù)據(jù)。
    C it is unnecessary to attempt to read byte by byte, the Read() method provides a very efficient way of reading into a byte array.
    沒(méi)有必要嘗試讀取字節(jié),read () 方法提供了非常有效的讀入一個(gè)字節(jié)數(shù)組。
    26、
    您正在編寫一個(gè)應(yīng)用程序,該應(yīng)用程序使用SOAP與其他程序交換數(shù)據(jù)。您使用從ArrayList繼承的Department類將對(duì)象發(fā)送到另一個(gè)應(yīng)用程序。Department對(duì)象名為dept。
    您需要確保應(yīng)用程序?qū)epartment對(duì)象進(jìn)行序列化以使用SOAP進(jìn)行傳輸。
    您應(yīng)該使用哪種代碼?
    A.
    SoapFormatter formatter = new SoapFormatter();
    bytes[] buffer = new byte[dept.Capacity];
    MemoryStream stream = new MemoryStream(buffer);
    foreach (object o in dept) {
    formatter.Serialize(stream, o);
    }
    B.
    SoapFormatter formatter = new SoapFormatter();
    bytes[] 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);
    Answer: D
    解釋/參考:
    說(shuō)明:只序列化到流,使用SoapFormatter的整個(gè)對(duì)象
    A&C attempt to serialize components of the object rather the object itself.
    要序列化的對(duì)象,而是對(duì)象本身的組件的嘗試。
    B attempts to serialize to an array, however the array will not be big enough to store the serialized object because it is not sized on the entire object.
    嘗試要序列化到一個(gè)數(shù)組中,但該數(shù)組將不會(huì)大到足以存儲(chǔ)序列化的對(duì)象,因?yàn)樗粚?duì)整個(gè)對(duì)象大小。
    27、您正在創(chuàng)建一個(gè)計(jì)算員工獎(jiǎng)金信息的類。該類包含一個(gè)名為GetBonusPercentage的方法(用于檢索當(dāng)前獎(jiǎng)金乘數(shù))和一個(gè)名為bonusPercent的變量(用于存儲(chǔ)當(dāng)前獎(jiǎng)金乘數(shù))。
    您編寫該類的序列化表現(xiàn)形式。
    您需要編寫一個(gè)代碼段,當(dāng)對(duì)該類的實(shí)例化進(jìn)行反序列化時(shí),該代碼段使用當(dāng)前獎(jiǎng)金乘數(shù)更新bonusPercent變量。(題庫(kù)無(wú),答案不確定)
    您應(yīng)該使用哪個(gè)代碼段?
    A、[OnSerializing]
    Internal void UpdateValue(StreamingContext context){
    bonusPercent = GetBonusPercentage();
    }
    B、[OnDeserialized]
    Internal void UpdateValue(StreamingContext context){
    bonusPercent = GetBonusPercentage();
    C、[OnSerializing]
    Internal void UpdateValue(SerializationInfo info){
    Info.AddValue(“bonusPercent”,GetBonusPercentage());
    }
    D、[OnDeserializing]
    Internal void UpdateValue(SerializationInfo info){
    Info.AddValue(“bonusPercent”,GetBonusPercentage());
    }
    Answer:B
    28、
    您正在創(chuàng)建一個(gè)名為Assembly1 的強(qiáng)名稱程序集,該程序集將在多個(gè)應(yīng)用程序中使用。在開發(fā)周期中,將會(huì)頻繁重新建立Assembly1。您需要確保該程序集在每次重新建立時(shí)都能與使用它的每個(gè)應(yīng)用程序正常協(xié)同工作。
    您需要配置在其中開發(fā)Assembly1 的計(jì)算機(jī),以使每個(gè)應(yīng)用程序都使用Assembly1 的最新版本。
    您應(yīng)該執(zhí)行哪兩項(xiàng)操作?(每個(gè)正確答案都僅給出了部分解決方案。請(qǐng)選擇兩個(gè)答案。)
    A. 創(chuàng)建一個(gè)DEVPATH 環(huán)境變量,該環(huán)境變量指向強(qiáng)名稱程序集的版本輸出目錄。
    B. 將以下XML 元素添加到計(jì)算機(jī)配置文件:
    
    publicKeyToken="32ab4ba45e0a69a1"
    language="en-US" version="*.*.*.*" />
    
    

    C. 將以下XML 元素添加到使用強(qiáng)名稱程序集的每個(gè)應(yīng)用程序的配置文件:
    
    D. 將以下XML 元素添加到計(jì)算機(jī)配置文件:
    
    E. 將以下XML 元素添加到使用強(qiáng)名稱程序集的每個(gè)應(yīng)用程序的配置文件:
    
    publicKeyToken="32ab4ba45e0a69a1"
    language="en-US" version="*.*.*.*" />
    
    

    Answer: AD
    解釋:計(jì)算機(jī)配置文件中的developmentmode元素告訴.net 運(yùn)行庫(kù)在由DevPath環(huán)境變量使用定位程序集。
    ·SupportedRuntime元素指定哪些.net 運(yùn)行庫(kù)版本程序集支持。
    ·DependentAssembly元素用于封裝每個(gè)程序集綁定策略和程序集位置。