為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(8)》供大家參考,希望對(duì)大家有所幫助?。?!
第 36 題
你開(kāi)發(fā)了一個(gè)需要部署的服務(wù)應(yīng)用。你的網(wǎng)絡(luò)管理員為你的服務(wù)應(yīng)用創(chuàng)建一個(gè)用戶賬號(hào)。你
需要配置你的服務(wù),讓它運(yùn)行在指定用戶賬號(hào)的上下文中。你應(yīng)該如何做?
A. 創(chuàng)建服務(wù)安裝類,設(shè)置ServiceInstaller類的StartType屬性。
B. 創(chuàng)建服務(wù)安裝類,設(shè)置ServiceProcessInstaller的Account, Username, 和 Password 屬性。
C. 使用net.exe 命令行工具的CONFIG 選項(xiàng)去安裝服務(wù)。
D. 使用 installutil.exe 命令行工具安裝服務(wù)。
答案: B
第 37 題
你正在創(chuàng)建一個(gè)使用非托管資源的類。這個(gè)類引用了使用托管資源的對(duì)象。你需要確保使用
這個(gè)類的用戶在不需要類實(shí)例的時(shí)候能夠夠釋放資源。你應(yīng)該做那三個(gè)工作?
(每個(gè)答案是解決方案的一部分)
A. 定義一個(gè)從WeakReference 繼承的類。
B. 定義一個(gè)實(shí)現(xiàn)IDisposable 接口的類。
C. 創(chuàng)建一個(gè)類析構(gòu)函數(shù),調(diào)用其它對(duì)象的方法去釋放托管資源。
D. 創(chuàng)建一個(gè)類析構(gòu)函數(shù),釋放非托管資源
E. 創(chuàng)建一個(gè)Dispose方法,調(diào)用System.GC.Collect 強(qiáng)制垃圾回收。
F. 創(chuàng)建一個(gè)Dispose方法,釋放非托管資源并且調(diào)用其它對(duì)象的方法釋放托管資源。
答案: B, D, F
第 38 題
你使用反射(Reflection)來(lái)獲得方法 MyMethod 的信息。你需要獲取 MyMethod 方法是否在
派生類中可以訪問(wèn),你應(yīng)該如何做?
A. 訪問(wèn)MethodInfo 的IsAssembly 屬性。
B. 訪問(wèn)MethodInfo 的IsVirtual屬性。
C. 訪問(wèn)MethodInfo 的IsStatic屬性。
D. 訪問(wèn)MethodInfo 的IsFamily屬性。
答案: D
第 39 題
你正在創(chuàng)建一個(gè)執(zhí)行復(fù)雜財(cái)務(wù)運(yùn)算的類。這個(gè)類包含一個(gè)方法 GetCurrentRate,它得到當(dāng)前
的匯率并保存在變量 currRate 中。你為此類實(shí)現(xiàn)了序列化。為此,你需要寫一段代碼,當(dāng)類被
反序列化后,能夠使用當(dāng)前的實(shí)際匯率更新 currRate 變量。你應(yīng)該使用下面那段代碼?
A. [OnSerializing]internal void UpdateValue (StreamingContext context) {
currRate = GetCurrentRate();}
B. [OnSerializing]internal void UpdateValue(SerializationInfo info)
{info.AddValue("currentRate", GetCurrentRate());}
C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());}
D. [OnDeserialized]internal void UpdateValue(StreamingContext context) {
currRate = GetCurrentRate();}
答案: D
第 40 題
你正在寫一個(gè)使用獨(dú)立存儲(chǔ)區(qū)(isolated storage)存儲(chǔ)用戶參數(shù)信息的應(yīng)用。應(yīng)用使用了多
個(gè)程序集,而且多個(gè)用戶將會(huì)在同一個(gè)機(jī)器上使用此應(yīng)用。你需要在當(dāng)前的 Microsoft
Windows 標(biāo)識(shí)和程序集的獨(dú)立存儲(chǔ)區(qū)內(nèi)創(chuàng)建一個(gè)目錄 Preferences。你應(yīng)該使用下面那段代
碼?
A. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForAssembly();store.CreateDirectory("Preferences");
B. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory("Preferences");
C. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForDomain();store.CreateDirectory("Preferences");
D. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory("Preferences");
答案: A
第 36 題
你開(kāi)發(fā)了一個(gè)需要部署的服務(wù)應(yīng)用。你的網(wǎng)絡(luò)管理員為你的服務(wù)應(yīng)用創(chuàng)建一個(gè)用戶賬號(hào)。你
需要配置你的服務(wù),讓它運(yùn)行在指定用戶賬號(hào)的上下文中。你應(yīng)該如何做?
A. 創(chuàng)建服務(wù)安裝類,設(shè)置ServiceInstaller類的StartType屬性。
B. 創(chuàng)建服務(wù)安裝類,設(shè)置ServiceProcessInstaller的Account, Username, 和 Password 屬性。
C. 使用net.exe 命令行工具的CONFIG 選項(xiàng)去安裝服務(wù)。
D. 使用 installutil.exe 命令行工具安裝服務(wù)。
答案: B
第 37 題
你正在創(chuàng)建一個(gè)使用非托管資源的類。這個(gè)類引用了使用托管資源的對(duì)象。你需要確保使用
這個(gè)類的用戶在不需要類實(shí)例的時(shí)候能夠夠釋放資源。你應(yīng)該做那三個(gè)工作?
(每個(gè)答案是解決方案的一部分)
A. 定義一個(gè)從WeakReference 繼承的類。
B. 定義一個(gè)實(shí)現(xiàn)IDisposable 接口的類。
C. 創(chuàng)建一個(gè)類析構(gòu)函數(shù),調(diào)用其它對(duì)象的方法去釋放托管資源。
D. 創(chuàng)建一個(gè)類析構(gòu)函數(shù),釋放非托管資源
E. 創(chuàng)建一個(gè)Dispose方法,調(diào)用System.GC.Collect 強(qiáng)制垃圾回收。
F. 創(chuàng)建一個(gè)Dispose方法,釋放非托管資源并且調(diào)用其它對(duì)象的方法釋放托管資源。
答案: B, D, F
第 38 題
你使用反射(Reflection)來(lái)獲得方法 MyMethod 的信息。你需要獲取 MyMethod 方法是否在
派生類中可以訪問(wèn),你應(yīng)該如何做?
A. 訪問(wèn)MethodInfo 的IsAssembly 屬性。
B. 訪問(wèn)MethodInfo 的IsVirtual屬性。
C. 訪問(wèn)MethodInfo 的IsStatic屬性。
D. 訪問(wèn)MethodInfo 的IsFamily屬性。
答案: D
第 39 題
你正在創(chuàng)建一個(gè)執(zhí)行復(fù)雜財(cái)務(wù)運(yùn)算的類。這個(gè)類包含一個(gè)方法 GetCurrentRate,它得到當(dāng)前
的匯率并保存在變量 currRate 中。你為此類實(shí)現(xiàn)了序列化。為此,你需要寫一段代碼,當(dāng)類被
反序列化后,能夠使用當(dāng)前的實(shí)際匯率更新 currRate 變量。你應(yīng)該使用下面那段代碼?
A. [OnSerializing]internal void UpdateValue (StreamingContext context) {
currRate = GetCurrentRate();}
B. [OnSerializing]internal void UpdateValue(SerializationInfo info)
{info.AddValue("currentRate", GetCurrentRate());}
C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());}
D. [OnDeserialized]internal void UpdateValue(StreamingContext context) {
currRate = GetCurrentRate();}
答案: D
第 40 題
你正在寫一個(gè)使用獨(dú)立存儲(chǔ)區(qū)(isolated storage)存儲(chǔ)用戶參數(shù)信息的應(yīng)用。應(yīng)用使用了多
個(gè)程序集,而且多個(gè)用戶將會(huì)在同一個(gè)機(jī)器上使用此應(yīng)用。你需要在當(dāng)前的 Microsoft
Windows 標(biāo)識(shí)和程序集的獨(dú)立存儲(chǔ)區(qū)內(nèi)創(chuàng)建一個(gè)目錄 Preferences。你應(yīng)該使用下面那段代
碼?
A. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForAssembly();store.CreateDirectory("Preferences");
B. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory("Preferences");
C. IsolatedStorageFile store;store =
IsolatedStorageFile.GetUserStoreForDomain();store.CreateDirectory("Preferences");
D. IsolatedStorageFile store;store =
IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory("Preferences");
答案: A