Which of the following XML blocks represents the output of serializing the Car class?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET as its application development platform.

You create the definition for a Car class by using the following code segment:

public class Car {

[XmlAttribute(AttributeName = "category")]

public string CarType;

public string model;

[XmlIgnore]

public int year;

[XmlElement(ElementName = "mileage")]

public int miles;

public ConditionType condition;

public Car() {

}

public enum ConditionType {

[XmlEnum("Poor")] BelowAverage,

[XmlEnum("Good")] Average,

[XmlEnum("Excellent")] AboveAverage

}}

You create an instance of the Car class. You fill the public fields of the Car class as shown in the table below:

You are required to recognize the XML block that is produced by the Car class after serialization.

Which of the following XML blocks represents the output of serializing the Car class?
A . <?xml version="1.0" encoding="utf-8"?>
<Car
xmlns:xsi="http://www.w3.org/2002/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2002/XMLSchema"
category="sedan">
<model>racer</model>
<mileage>15000</mileage>
<conditionType>Excellent</conditionType>
</Car>
B . <?xml version="1.0" encoding="utf-8"?>
<Car
xmlns:xsi="http://www.w3.org/2002/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2002/XMLSchema"
category="sedan">
<model>racer</model>
<mileage>15000</mileage>
<condition>Excellent</condition>
</Car>

C . <?xml version="1.0" encoding="utf-8"?>
<Car
xmlns:xsi="http://www.w3.org/2002/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2002/XMLSchema""
CarType="sedan">
<model>racer</model>
<miles>15000</miles>
<condition>AboveAverage</condition>
</Car>
D . <?xml version="1.0" encoding="utf-8"?>
<Car
xmlns:xsi="http://www.w3.org/2002/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2002/XMLSchema">
<category>sedan</category>
<model>racer</model>
<mileage>15000</mileage>
<condition>Excellent</condition>
</Car>

Answer: B

Leave a Reply

Your email address will not be published.