exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 26 discussion

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

You are developing an ASP.NET MVC application in Visual Studio 2012. The application supports multiple cultures.
The application contains three resource files in the Resources directory:
✑ ProductDictionary.resx
✑ ProductDictionary.es.resx
✑ ProductDictionary.fr.resx
Each file contains a public resource named Currency with the localized currency symbol. 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.LocalizedCurrency to the localized currency contained in the resource files.
Which code segment should you add to the action at line 03?

  • A. ViewBag.LocaIizedCurrency = Resources.ProductDictionary.Currency;
  • B. ViewBag.LocalizedCurrency = HttpContext.GetGlobalResourceObject("ProductDictionary", "Currency", new System.Globalization.CultureInfo(Men"));
  • C. ViewBag.LocalizedCurrency = HttpContext.GetLocalResourceObject("ProductDictionary","Currency");
  • D. ViewBag.LocalizedCurrency = HttpContext.GetGlobalResourceObject("ProductDictionary", "Currency");
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
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
rortegax2
4 years, 5 months ago
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 4 times
Kuna_Lambo
4 years, 4 months ago
Thank You!
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 ...