exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 4 discussion

Actual exam question from Microsoft's 70-486
Question #: 4
Topic #: 1
[All 70-486 Questions]

You are developing an ASP.NET MVC application in Visual Studio. The application supports multiple cultures.
The application contains three resource files in the Resources directory:
✑ MyDictionary.resx
✑ MyDictionary.es.resx

MyDictionary.fr.resx -

Each file contains a public resource named Title with localized translation.
The application is configured to set the culture based on the client browser settings.
The application contains a controller with the action defined in the following code segment. (Line numbers are included for reference only.)

You need to set ViewBag.Title to the localized title contained in the resource files.
Which code segment should you add to the action at line 03?

  • A. ViewBag.Title = HttpContext.GetGlobalResourceObject("MyDictionary", "Title");
  • B. ViewBag.Title = HttpContext.GetGlobalResourceObject("MyDictionary", "Title", new System.Globalization.CultureInfo("en"));
  • C. ViewBag.Title = Resources.MyDictionary.Title;
  • D. ViewBag.Title = HttpContext.GetLocalResourceObject("MyDictionary", "Title");
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
Only the Resources class is used.

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
apostolin
Highly Voted 5 years, 9 months ago
The correct answer is: C.
upvoted 10 times
...
Kuna_Lambo
Most Recent 4 years, 5 months ago
rortegax2 put this great message in similar Question #26: "Correct answer is A, but given explanation is incorrect: it doesn't exist any Resources class. You can only suppose that "Resources" should be the namespace used in an auto-generated ProductDictionary.cs file, with a ProductDictionary internal class using the ResourceManager class. Generated namespace uses the name Resources because the given ProductDictionary.resx files are located under the Resources folder, according to the the question. Answer C is incorrect because it's using GetLocalResourceObject, that is used to get a page-level resource at App_LocalResources folder. Answers B and D, use GetGlobalResourceObject, that could be used to get resources located under App_GlobalResources folder. So they are also incorrect."
upvoted 1 times
...
markcowell
4 years, 8 months ago
Correct Answer is C
upvoted 2 times
...
hungry_ape9000
5 years, 1 month ago
FINAL ANSWER: C is correct
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 ...