Multiple choice technology web technology

When identical data is to be presented on desktop and mobile browsers, with only changes to CSS stylesheets, which of the following is the best option?

  1. Create separate areas for desktop and mobile browsers

  2. Use same controllers and views for desktop and mobile browsers, but render views with different razor layouts for desktop and mobile browsers.

  3. Do nothing

  4. Use same controllers, but render different views for desktop and mobile browsers.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When the same data is served to desktop and mobile with only CSS changes, the best MVC approach is to use the same controllers and views but switch Razor layouts dynamically. This avoids code duplication while allowing device-specific styling through different layout files. Option A creates unnecessary duplication, option D duplicates views unnecessarily, and option C is not a viable solution.