Developing ASP.NET MVC Web Applications — Question 140

If the canvas element is supported by the client browser, the application must display "London 2012" in the footer as text formatted by JavaScript at the end of the
_Layout.cshtml file.
You need to modify the layout to ensure that "London 2012" is displayed as either formatted text or as plain text, depending on what the client browser supports.
Which code segment should you add?

Answer options

Correct answer: C

Explanation

The correct answer is C because it correctly displays 'London 2012' within a canvas element, which is the requirement when the browser supports it. Option A is incorrect because it includes unnecessary conditional logic for Java applets, while option B does not leverage the canvas for formatting. Option D uses a paragraph tag but does not utilize the canvas element for displaying the text.