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

字號:

為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(13)》供大家參考,希望對大家有所幫助?。。?BR>    第 61 題
    你寫了一個包含如下代碼的類 Employee:
    public class Employee
    {
    string employeeId, employeeName, jobTitleName;
    public string GetName() { return employeeName; }
    public string GetTitle() { return jobTitleName; }
    }
    你需要在類型庫中把這個類公開為COM。而且COM接口能夠向前兼容Employee類的新版本。
    你需要選擇一種方法去生成COM接口,你應(yīng)該怎么做?
    A. 增加如下的屬性定義:
    [ClassInterface(ClassInterfaceType.None)]public class Employee {
    B. 增加如下的屬性定義:
    [ClassInterface(ClassInterfaceType.AutoDual)]public class Employee {
    C. [ComVisible(true)]public class Employee {
    D. 為類定義一個接口并增加如下的屬性定義
    [ClassInterface(ClassInterfaceType.None)]public class Employee : IEmployee{
    答案: D
    第 62 題
    你正在寫一個接收 DateTime 參數(shù)、返回一個 Boolean 值的多路委托,你應(yīng)該使用下面那個
    代碼段?
    A. public delegate int PowerDeviceOn(bool,DateTime);
    B. public delegate bool PowerDeviceOn(Object,EventArgs);
    C. public delegate void PowerDeviceOn(DateTime);
    D. public delegate bool PowerDeviceOn(DateTime);
    答案: A
    第 63 題
    你正在創(chuàng)建一個存儲數(shù)據(jù)修改的撤銷緩沖區(qū)(undo buffer)。你需要保證撤銷功能首先撤銷
    最近的數(shù)據(jù)修改,而且撤銷緩沖區(qū)只允許存儲字符串。你應(yīng)該使用下面那段代碼實現(xiàn)?
    A. Stack undoBuffer = new Stack();
    B. Stack undoBuffer = new Stack();
    C. Queue undoBuffer = new Queue();
    D. Queue undoBuffer = new Queue();
    答案: A
    第 64 題
    你創(chuàng)建了一個 Vehicle 類的定義如下:
    public class Vehicle
    {
    [XmlAttribute(AttributeName = "category")]
    public string vehicleType;
    public string model;
    [XmlIgnore]
    public int year;
    [XmlElement(ElementName = "mileage")]
    public int miles;
    public ConditionType condition;
    public Vehicle() {
    }
    public enum ConditionType {
    [XmlEnum("Poor")] BelowAverage,
    [XmlEnum("Good")] Average,
    [XmlEnum("Excellent")] AboveAverage
    }
    }
    你創(chuàng)建了類Vehicle 的一個實例。你為Vehicle 類實例的public字段指定了如下的值:
    vehicleType:car;mode:lracer;year:2002;miles:15000;condition:AboveAverage
    你需要識別出下面那個XML段是Vehicle類實例被序列化后的輸出?
    A.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema""
    vehicleType="car">
    racer
    15000
    AboveAverage
    
    B.
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    category="car">
    racer
    15000
    Excellent
    

    C.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    category="car">
    racer
    15000
    Excellent
    
    D.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    car
    racer
    15000
    Excellent
    
    答案: B
    第 65 題
    你正在測試一個組件,它把Meeting類實例序列化后保存到文件系統(tǒng)中。其中Meeting類定義如
    下:
    public class Meeting
    {
    private string title;
    public int roomNumber;
    public string[] invitees;
    public Meeting(){}
    public Meeting(string t){title = t;}
    }
    組件中的一個過程包含如下代碼:
    Meeting myMeeting = new Meeting("Goals");
    myMeeting.roomNumber = 1100;
    string[] attendees = new string[2]{"Company", "Mary"};
    myMeeting.invitees = attendees;
    XmlSerializer xs = new XmlSerializer(typeof(Meeting));
    StreamWriter writer = new StreamWriter(@"C:\Meeting.xml");
    Xs.Serialize(writer, myMeeting);
    writer.Close();
    你需要識別出下面那個XML塊是C:\Meeting.xml文件的內(nèi)容?
    A.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    Goals
    1100
    Company
    Mary
    

    B.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    1100
    
    Company
    Mary
    

    

    C.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    title="Goals">
    1100
    
    Company
    Mary
    

    

    D.
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    1100
    
    Company
    

    
    Mary
    

    

    答案: B