exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 62 discussion

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

You are developing an application that includes a method named SendMessage.
You need to ensure that the SendMessage() method is called with the required parameters.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️
D: ExpandoObject -
Represents an object whose members can be dynamically added and removed at run time.
✑ The ExpandoObject class enables you to add and delete members of its instances at run time and also to set and get values of these members. This class supports dynamic binding, which enables you to use standard syntax like sampleObject.sampleMember instead of more complex syntax like sampleObject.GetAttribute("sampleMember").
✑ You can pass instances of the ExpandoObject class as parameters. Note that these instances are treated as dynamic objects in C# and late-bound objects in
Visual Basic. This means that you do not have IntelliSense for object members and you do not receive compiler errors when you call non-existent members. If you call a member that does not exist, an exception occurs.
Note:
Visual C# 2010 introduces a new type, dynamic. The type is a static type, but an object of type dynamic bypasses static type checking. In most cases, it functions like it has type object. At compile time, an element that is typed as dynamic is assumed to support any operation. Therefore, you do not have to be concerned about whether the object gets its value from a COM API, from a dynamic language such as IronPython, from the HTML Document Object Model (DOM), from reflection, or from somewhere else in the program. However, if the code is not valid, errors are caught at run time.

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
hseagraves
3 years, 11 months ago
The answer D is here: https://www.briefmenow.org/microsoft/which-two-code-segments-can-you-use-to-achieve-this-goal-5/
upvoted 2 times
...
SJBada2020
4 years ago
D will be static void Main(string[] args) { dynamic message = new ExpandoObject(); message.From = "Jon Morris"; message.To = "Mary North"; message.Content = "Hello World"; SendMessage(message); } private static void SendMessage(dynamic msg) { Console.WriteLine(msg.From); Console.WriteLine(msg.To); Console.WriteLine(msg.Content); } https://docs.microsoft.com/en-us/dotnet/api/system.dynamic.expandoobject?view=net-5.0
upvoted 2 times
...
GeorgeMg
4 years, 4 months ago
CD D is probably like this: static void Main(string[] args) { dynamic message = new {From = "Jon Morris", To = "Mary North", Content = "Hello World" }; SendMessage(message); } private static void SendMessage(dynamic msg) { Console.WriteLine(msg.From); Console.WriteLine(msg.To); Console.WriteLine(msg.Content); }
upvoted 2 times
...
supersunny
5 years, 4 months ago
CD are the correct ones
upvoted 4 times
ArunPrem
4 years, 8 months ago
Since you are saying D also a correct option and the option D is not shown completely, can you provide what is the complete answer for D?
upvoted 7 times
noussa
3 years, 11 months ago
Link for complete question: https://www.briefmenow.org/microsoft/which-two-code-segments-can-you-use-to-achieve-this-goal-11/
upvoted 1 times
...
...
...
Oziriz
5 years, 11 months ago
Option D not all the way shown :(
upvoted 2 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