exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 73 discussion

Actual exam question from Microsoft's 70-483
Question #: 73
Topic #: 2
[All 70-483 Questions]

HOTSPOT -
You have an existing order processing system that accepts .xml files,
The following code shows an example of a properly formatted order in XML:

You create the following class that will be serialized:

For each of the following properties, select Yes if the property is serialized according to the defined schema. Otherwise, select No.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
testing
Highly Voted 5 years, 9 months ago
No, No ,Yes
upvoted 41 times
...
lorenzino
Highly Voted 4 years, 7 months ago
No- No- Yes Tested: [DataContract()] public class Order { [DataMember()] public int OrderID { get; set; } [DataMember(Name = "Customer")] public string CustomerName { get; set; } [DataMember()] public int CustomerId { get; set; } public DateTime OrderDate { get; set; } } Output : <?xml version="1.0" encoding="utf-8"?> <Order xmlns="http://schemas.datacontract.org/2004/07/_70_483PracticeTested" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Customer>Lorenzo</Customer> <CustomerId>2</CustomerId> <OrderID>1</OrderID> </Order>
upvoted 14 times
...
HgstExam
Most Recent 4 years, 3 months ago
NO - OrderId serialized as element instead of attribute NO - Orderdate not serialized when it should be YES - Customer element both serialized the same Defined Schema ---------------- <Order OrderId="42"> <Customer>Ben Smith</Customer> <CustomerID>206</CustomerID> <OrderDate>2013-04-19T09:13:14.1111-05:00</OrderDate> </Order> Serialized ----------- <Order> <OrderID>42</Orderid> <Customer>Ben Smith</Customer> <CustomerID>206</CustomerID> </Order>
upvoted 4 times
...
joaofca
4 years, 3 months ago
1) No - I think that he OrderID member should be serialized as a Element and not as a Attribute ("if the property is serialized according to the defined schema") 2) No - Because you need the [DataMemberAttribute] and CustomerDate doesn't have it, so it shoulnd't appear in the xml document 3) Yes - Because the schema defines its name as element "Customer", that does appear in the document
upvoted 2 times
noussa
3 years, 11 months ago
for the second one, it's not true case you already decorated the class with DataContract so everything will be serialized by default. DataMemeber is used for further info like(order, specific name, ....) Please do not confuse other read a bit about it before you post. Please refer to these links for further details: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.datacontractattribute?view=net-5.0 https://stackoverflow.com/questions/4836683/when-to-use-datacontract-and-datamember-attributes So the answer for the second is definitely YES
upvoted 1 times
noussa
3 years, 11 months ago
Sorry I was wrong the second link of StackOverflow holds the wrong info. This is the definition from MS docs about DataContract and DataAttribte: You must also apply the DataMemberAttribute to any field, property, or event that holds values you want to serialize. By applying the DataContractAttribute, you explicitly enable the DataContractSerializer to serialize and deserialize the data. Caution You can apply the DataMemberAttribute to private fields. Be aware that the data returned by the field (even if it is private) is serialized and deserialized, and thus can be viewed or intercepted by a malicious user or process. Link: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.datacontractattribute?view=net-5.0 So it's NO, NO, YES The first one is NO cause Serialization with DataContract does not support XAttribute just XElement.
upvoted 1 times
...
...
...
WasifBhatti
4 years, 5 months ago
No,No,Yes
upvoted 1 times
...
Jannie
4 years, 5 months ago
No, No, Yes
upvoted 1 times
...
nelaed
4 years, 7 months ago
Using DataContractSerializer you can't serialize field that don't have DataMember attribute but private members are ok. Yes, No, Yes. Using XMLSerializer it's YES, YES, YES - because this serializer does print every public member. I think the question might be incomplete.
upvoted 3 times
...
mmarinov
4 years, 7 months ago
NO, NO, YES!!!! The DataMember != Attribute!
upvoted 6 times
...
Sully_2020
4 years, 9 months ago
Yes, No, Yes — To prepare a class for serialization, apply the DataContractAttribute to the class. For each member of the class that returns data that you want to serialize, apply the DataMemberAttribute. You can serialize fields and properties, regardless of accessibility: private, protected, internal, protected internal, or public. To create a type that conforms to the contract, first apply the DataContractAttribute to the class. Then apply the DataMemberAttribute to every field or property that you want to serialize. ( https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.datacontractserializer?view=netframework-4.8 )
upvoted 3 times
fabio76
4 years, 7 months ago
DataMemberAttribute, by default, serialize properties as XML elements, not as XML attributes. So the answer should be NO,NO,YES If you want to serialize a property as an XML attribute must follow this: https://stackoverflow.com/questions/4858798/datacontract-xml-serialization-and-xml-attributes
upvoted 4 times
...
...
sscooter1010
4 years, 10 months ago
No, No, Yes.
upvoted 4 times
...
Igris
4 years, 11 months ago
OrderId is an attribute and not a Xelement os i dont think it will be deserialized unless we use an xml parser which is not the case
upvoted 2 times
...
natsk8freak
5 years ago
YES,NO,YES https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.datacontractserializer?view=netframework-4.8
upvoted 6 times
...
Oziriz
5 years, 11 months ago
Question doesn't show options and answers not shown.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago