exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 66 discussion

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

You are troubleshooting an application that uses a class named FullName. The class is decorated with the DataContractAttribute attribute. The application includes the following code. (Line numbers are included for reference only.)

You need to ensure that the entire FullName object is serialized to the memory stream object.
Which code segment should you insert at line 09?

  • A. binary.WriteEndElement();
  • B. binary.NriteEndDocument();
  • C. ms.Close();
  • D. binary.Flush();
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
✑ DataContractSerializer.WriteEndObject Method (XmlDictionaryWriter)
Writes the closing XML element using an XmlDictionaryWriter.
✑ Note on line 07: DataContractSerializer.WriteObject Method
Writes all the object data (starting XML element, content, and closing element) to an XML document or stream.
XmlDictionaryWriter

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
rdorado
Highly Voted 5 years, 8 months ago
La correcta es la D
upvoted 33 times
...
Sully_2020
Highly Voted 4 years, 8 months ago
This is the same question (except with a typo in the answer choices) as question # 41 on page 27. The correct answer is D, binary.Flush(); (see the C# code example located on https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/datacontractserializer-sample ) -> By default, the DataContractSerializer encodes objects into a stream using a textual representation of XML. However, you can influence the encoding of the XML by passing in a different writer. The sample creates a binary writer by calling CreateBinaryWriter. It then passes the writer and the record object to the serializer when it calls WriteObjectContent. Finally, the sample flushes the writer ...
upvoted 9 times
...
Qadar
Most Recent 4 years ago
Its D.
upvoted 3 times
...
Farrukh387
4 years ago
D is correct answer.. it requires flush
upvoted 2 times
...
whtvr
4 years, 9 months ago
The explanation of this question is clearly wrong, or the picture in the question is wrong, because for what's in the picture I'd also say it should be D
upvoted 3 times
...
sscooter1010
4 years, 10 months ago
When I code this one up, it doesn't get into the MemoryStream object until I execute binary.Flush(). Why is the correct answer B?
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