You create the definition for a Vehicle class by using the following code segment.

You create the definition for a Vehicle class by using the following code segment.
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
}}
You create an instance of the Vehicle class. You populate the public fields of the Vehicle class
instance as shown in the following table:
MemberValuevehicleTypecarmodelraceryear2002miles15000conditionAboveAverage
You need to identify the XML block that is produced when this Vehicle class instance is
serialized.
Which block of XML represents the output of serializing the Vehicle instance?


A. <?xml version="1.0" encoding="utf-8"?>
    <Vehicle
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema""
    vehicleType="car">
    <model>racer</model>
    <miles>15000</miles>
    <condition>AboveAverage</condition>
    </Vehicle>
B. <?xml version="1.0" encoding="utf-8"?>
    <Vehicle
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    category="car">
    <model>racer</model>
    <mileage>15000</mileage>
    <condition>Excellent</condition>
    </Vehicle>
C. <?xml version="1.0" encoding="utf-8"?>
    <Vehicle
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    category="car">
    <model>racer</model>
    <mileage>15000</mileage>
    <conditionType>Excellent</conditionType>
    </Vehicle>
D. <?xml version="1.0" encoding="utf-8"?>
    <Vehicle
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <category>car</category> 
 <model>racer</model>
    <mileage>15000</mileage>
    <condition>Excellent</condition>
    </Vehicle>


Answer: B 



No comments:

Post a Comment