Previous Question

Question 97

Next Question

3.2.2 Question

Multiple Choice

You are creating an ASP.NET MVC website and you want to replace a <h2>hello</h2> tag within the view with custom resources you have created. What should you use?

  • A. <h2>@mvcapp.Resources.Home.Index.Heading</h2>
  • B. <h2 div="resource">Hello</h2>
  • C. <h2 class="resource">Hello</h2>
  • D. <h2>@mvcapp.Resources.Home.Index.Heading Hello</h2>

Answer:

A
Explanation
A. Correct: This is the correct way to insert resources into a view.
B. Incorrect: The <div> tag cannot be used to insert resources into a view.
C. Incorrect: This attempts to style the element, looking for a style named “resource.”
D. Incorrect: Although this inserts resources into the view, it also adds Hello to the end of the header tag.