為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(8)》供大家參考,希望對大家有所幫助?。?!
第 36 題
你開發(fā)了一個需要部署的服務(wù)應(yīng)用。你的網(wǎng)絡(luò)管理員為你的服務(wù)應(yīng)用創(chuàng)建一個用戶賬號。你
需要配置你的服務(wù),讓它運(yùn)行在指定用戶賬號的上下文中。你應(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)建一個使用非托管資源的類。這個類引用了使用托管資源的對象。你需要確保使用
這個類的用戶在不需要類實(shí)例的時候能夠夠釋放資源。你應(yīng)該做那三個工作?
(每個答案是解決方案的一部分)
A. 定義一個從WeakReference 繼承的類。
B. 定義一個實(shí)現(xiàn)IDisposable 接口的類。
C. 創(chuàng)建一個類析構(gòu)函數(shù),調(diào)用其它對象的方法去釋放托管資源。
D. 創(chuàng)建一個類析構(gòu)函數(shù),釋放非托管資源
E. 創(chuàng)建一個Dispose方法,調(diào)用System.GC.Collect 強(qiáng)制垃圾回收。
F. 創(chuàng)建一個Dispose方法,釋放非托管資源并且調(diào)用其它對象的方法釋放托管資源。
答案: B, D, F
第 38 題
你使用反射(Reflection)來獲得方法 MyMethod 的信息。你需要獲取 MyMethod 方法是否在
派生類中可以訪問,你應(yīng)該如何做?
A. 訪問MethodInfo 的IsAssembly 屬性。
B. 訪問MethodInfo 的IsVirtual屬性。
C. 訪問MethodInfo 的IsStatic屬性。
D. 訪問MethodInfo 的IsFamily屬性。
答案: D
第 39 題
你正在創(chuàng)建一個執(zhí)行復(fù)雜財務(wù)運(yùn)算的類。這個類包含一個方法 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 題
你正在寫一個使用獨(dú)立存儲區(qū)(isolated storage)存儲用戶參數(shù)信息的應(yīng)用。應(yīng)用使用了多
個程序集,而且多個用戶將會在同一個機(jī)器上使用此應(yīng)用。你需要在當(dāng)前的 Microsoft
Windows 標(biāo)識和程序集的獨(dú)立存儲區(qū)內(nèi)創(chuàng)建一個目錄 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 題
你開發(fā)了一個需要部署的服務(wù)應(yīng)用。你的網(wǎng)絡(luò)管理員為你的服務(wù)應(yīng)用創(chuàng)建一個用戶賬號。你
需要配置你的服務(wù),讓它運(yùn)行在指定用戶賬號的上下文中。你應(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)建一個使用非托管資源的類。這個類引用了使用托管資源的對象。你需要確保使用
這個類的用戶在不需要類實(shí)例的時候能夠夠釋放資源。你應(yīng)該做那三個工作?
(每個答案是解決方案的一部分)
A. 定義一個從WeakReference 繼承的類。
B. 定義一個實(shí)現(xiàn)IDisposable 接口的類。
C. 創(chuàng)建一個類析構(gòu)函數(shù),調(diào)用其它對象的方法去釋放托管資源。
D. 創(chuàng)建一個類析構(gòu)函數(shù),釋放非托管資源
E. 創(chuàng)建一個Dispose方法,調(diào)用System.GC.Collect 強(qiáng)制垃圾回收。
F. 創(chuàng)建一個Dispose方法,釋放非托管資源并且調(diào)用其它對象的方法釋放托管資源。
答案: B, D, F
第 38 題
你使用反射(Reflection)來獲得方法 MyMethod 的信息。你需要獲取 MyMethod 方法是否在
派生類中可以訪問,你應(yīng)該如何做?
A. 訪問MethodInfo 的IsAssembly 屬性。
B. 訪問MethodInfo 的IsVirtual屬性。
C. 訪問MethodInfo 的IsStatic屬性。
D. 訪問MethodInfo 的IsFamily屬性。
答案: D
第 39 題
你正在創(chuàng)建一個執(zhí)行復(fù)雜財務(wù)運(yùn)算的類。這個類包含一個方法 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 題
你正在寫一個使用獨(dú)立存儲區(qū)(isolated storage)存儲用戶參數(shù)信息的應(yīng)用。應(yīng)用使用了多
個程序集,而且多個用戶將會在同一個機(jī)器上使用此應(yīng)用。你需要在當(dāng)前的 Microsoft
Windows 標(biāo)識和程序集的獨(dú)立存儲區(qū)內(nèi)創(chuàng)建一個目錄 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

