PrepAway - Latest Free Exam Questions & Answers

Choose the XML block that signifies the output of serializing the Vehicle class instance.

You work as the application developer at Domain.com.
You write the definition for a class named Vehicle by defining 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 next create an instance of the Vehicle class, and add the following data in the defined fields of the class instance:
You must now identify the XML block that is generated when the Vehicle class instance is serialized.

Choose the XML block that signifies the output of serializing the Vehicle class instance.

PrepAway - Latest Free Exam Questions & Answers

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>

One Comment on “Choose the XML block that signifies the output of serializing the Vehicle class instance.


Leave a Reply