Choose the XML block that shows which content will be written to the C:Meeting.xml file?

You work as the application developer at Domain.com.
You are working on a component which serializes the Meeting class instances.
The definition of the Meeting class is as follows:
public class Meeting {
private string title;
public int roomNumber;
public string[] invitees;
public Interview(){
}
public Interview (string t){
title = t;
} }
You configure the following procedure for your component:
Meeting myMeeting = new Meeting(“Objectives”);
myMeeting.roomNumber=20;
string[] attendees = new string[2]{“Amy”, “Ally”};
myMeeting.invitees = attendees;
XmlSerializer xs = new XmlSerializer(typeof(Meeting));
StreamWriter writer = new StreamWriter(@”C:Meeting.xml”);
xs.Serialize(writer, myMeeting);
writer.Close();
You want to find out which XML block will be written to the C:Meeting.xml file when the procedure is executed.
Choose the XML block that shows which content will be written to the
C:Meeting.xml file?

You work as the application developer at Domain.com.
You are working on a component which serializes the Meeting class instances.
The definition of the Meeting class is as follows:
public class Meeting {
private string title;
public int roomNumber;
public string[] invitees;
public Interview(){
}
public Interview (string t){
title = t;
} }
You configure the following procedure for your component:
Meeting myMeeting = new Meeting(“Objectives”);
myMeeting.roomNumber=20;
string[] attendees = new string[2]{“Amy”, “Ally”};
myMeeting.invitees = attendees;
XmlSerializer xs = new XmlSerializer(typeof(Meeting));
StreamWriter writer = new StreamWriter(@”C:Meeting.xml”);
xs.Serialize(writer, myMeeting);
writer.Close();
You want to find out which XML block will be written to the C:Meeting.xml file when the procedure is executed.
Choose the XML block that shows which content will be written to the
C:Meeting.xml file?

A.
<?xml version=”1.0″ encoding=”utf-8″?>
<Meeting xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<title>Objectives</title>
<roomNumber>20</roomNumber>
<invitee>Amy</invitee>
<invitee>Ally</invitee>
</Meeting>

B.
<?xml version=”1.0″ encoding=”utf-8″?>
<Meeting xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<roomNumber>20</roomNumber>
<invitees>
<string>Amy</string>
<string>Ally</string>
</invitees>
</Meeting>

C.
<?xml version=”1.0″ encoding=”utf-8″?>
<Meeting xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” title=”Objectives”>
<roomNumber>20</roomNumber>
<invitees>
<string>Amy</string>
<string>Ally</string>
</invitees>
</Meeting>

D.
<?xml version=”1.0″ encoding=”utf-8″?>
<Meeting xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<roomNumber>20</roomNumber>
<invitees>
<string>Amy</string>
</invitees>
<invitees>
<string>Ally</string>
</invitees>
</Meeting>

Explanation:

A & C show title member in the XML. Title is a private member hence will not be serialized to XML.
D Shows multiple Invitees. There is only one object of type Invitees in the class definition.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


networkmanagers

networkmanagers

I agree with the answer.