Latest MVC ASP Dotnet Multiple choice Questions
1. Which is the best approach to assign a session in MVC?
A) System.Web.HttpContext.Current.Session[“LoginID”] =7;
B) Current.Session[“LoginID”] =7;
C) Session[“LoginID”] =7;
D) None
Ans: B
2. RedirectToActionPermanent() Method for which Status code represents?
A) 304
B) 302
C) 301
D) 300
E) None
Ans: C
3. RedirectToAction() Method for which Status code represents?
A) 304
B) 302
C) 301
D) 300
E) None
Ans: B
4. What is ActionResult() ?
A) It is an abstract Class
B) It is a Concrete Class
C) Both A and B
D) None
Ans: A
5. What is ViewResult() ?
A) It is an abstract Class
B) It is a Concrete Class
C) Both A and B
D) None
Ans: b
6. return View() works like in ASP.Net MVC C# as
A) Server.Transfer()
B) Response.Redirect()
C) Both A and B
D) None
Ans: A
7. RedirectToAction() works like in ASP.Net MVC C# as
A) Server.Transfer()
B) Response.Redirect()
C) Both A and B
D) None
Ans: B
8. In which format data can be return from XML into table ?
A) DataSet
B) Datatable
C) A and B
D) None
Ans: A
9. Can we use view state in MVC ?
A) Yes
B) No
C) Both A & B
D) None
Ans: B
10. What Request Processing technique follows ASP.Net ?
A) Top-Down
B) Down-Up
C) Pipeline
D) Water fall
Ans: C
11. What is DRY principle in ASP.Net ?
A) Don’t repeat yourself.
B) Don’t revise yourself.
C) both a and b
D) None
Ans: A
12. What is default authentication in Internet Information Services (IIS)?
A) Standard User
B) Administrator
C) Anonymous
D) None
Ans: C
13. What is the extension of MVC view when using C#?
A) cshtml
B) vbhtml
C) None
D) Both A & B
Ans: A
14. What is the extension of MVC view when using vb.net?
A) cshtml
B) vbhtml
C) None
D) Both A & B
Ans: B
15. How can you comment using Razor Syntax?
A) *@ Comment me *@
B) @* Comment me *@
C) @* Comment me @*
D) *@ Comment me @*
E) None
Ans: B
16. Which Namespace is used for Razor View Engine ?
A) System.Web.Razor
B) System.Web.Mvc.WebFormViewEngine
C) Both A & B
D) None
Ans: A
17. Which Namespace is used for ASPX View Engine ?
A) System.Web.Razor
B) System.Web.Mvc.WebFormViewEngine
C) Both A & B
D) None
Ans: B
18. The Razor View Engine uses to render server side content.
A) @
B) <%= %>
C) Both A & B
D) None
Ans: A
19. The ASPX View Engine uses to render server side content.
A) @
B) <%= %>
C) Both A & B
D) None
Ans: B
20. Which is more faster between ASPX View Engine and Razor View Engine.
A) ASPX View Engine
B) Razor View Engine
C) Both A & B
D) None
Ans: A
21. Does Razor Engine supports for TDD ?
A) Yes
B) No
C) None
Ans: A
22. Does ASPX View Engine supports for TDD ?
A) Yes
B) No
C) None
Ans: B
22. How to Print value from Controller to View in MVC ?
A) ViewBag.ECMDetail = “my message”; and in view @ViewBag.ECMDetail
B) ViewBag.ECMDetail = “my message”; and in view ViewBag.ECMDetail
B) ViewBag.ECMDetail = “my message”; and in view ViewBag.Title
D) None
Ans: A
28. Are MVC and Web API merged into one in MVC 6?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
29. Does MVC 6 introduced new JSON project based structure?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
30. Does MVC 6 allow only save change, hitting the save but then refreshing the browser to reflect changes?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
31. Does vNext is now Open Sourced via the .NET Foundation and open to public contributions.
A) Yes
B) No
C) Both A & B
D) None
Ans: A
32. Can vNext runs on both Mac and Linux today (Mono Version)?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
34. How does work Viewstart in MVC (ASP.Net)?
A) Viestart is used to layout of the application.
B) Viewstart is used like Masterpage in traditional forms (ASP.Net pages).
C) Viewstart render first in the views.
D) A, B and C.
E) None
Ans: D
35. Viewstart comes under which folder name ?
A) Views
B) Account
C) Shared
D) Home
Ans: A
36. Does Viewstart override all Views layout/template under “Views” folder in MVC ?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
37. What is the name of default Viewstart Page in ASP.Net MVC ?
A) _ViewStart.cshtml
B) _Layout.cshtml
C) _Login.cshtml
D) None
Ans: A
41. Which is the way to render Partial View using ASP.Net MVC Razor Engine?
A) @Html.Partial(“_PartialHeader”)
B) @Html.PartialView(“_PartialHeader”)
C) @Html.PartialHtml(“_PartialHeader”)
D) B and C
E) None
Ans: A
42. Which Namespace is used to “Display” in Data Annotation using MVC ?
A) System.ComponentModel
B) System.ComponentModel.DataAnnotations
C) Both A and B
D) None
Ans: A
43. Which Namespaces are required to Data Annotation using MVC ?
A) System.ComponentModel
B) System.ComponentModel.DataAnnotations
C) Both A and B
D) None
Ans: C
44. Are both TempData/ViewData require typecasting in MVC?
A) Both (TempData/ViewData) requires type casting to avoid null exception.
B) No, these (TempData/ViewData) does not require type casting.
C) Both A) & B)
D) None
Ans: A
45. Is ViewBag slower than ViewData in MVC?
A) Yes
B) No
C) Both A) & B)
D) None
Ans: A
46. Is ViewData faster than ViewBag in MVC?
A) Yes
B) No
C) Both A) & B)
D) None
Ans: A
47. Are both TempData/ViewData property of Controller base class in MVC?
A) Yes
B) No
C) Both A) & B)
D) None
Ans: A
48. Does TempData used to pass data from one page to another page in MVC?
A) Yes
B) No
C) Both A) & B)
D) None
Ans: A
49. Can ASP.Net Web API specialize to XML or JSON ?
A) Yes
B) No
C) None
Ans: A
50. Does Web API (ASP.Net) supports to non SOAP based like XML or JSON ?
A) Yes
B) No
C) None
Ans: A
51. Does Web API (ASP.Net) supports to both version mobile apps and others ?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
52. Can ASP.Net Web API, it works HTTP standard verbs like POST, GET, PUT, DELETE (CRUD Operations) ?
A) Yes
B) No
C) Both A & B
D) None
Ans: A
53. Can ASP.Net Web API ability to both self hosting (outside of IIS) and IIS ?
A) Yes
B) No
C) None
Ans: A
54. Can ASP.Net Web API has ability to transport non HTTP protocols like TCP, UDP, Named Pipes etc ?
A) Yes
B) No
C) None
Ans: B
55. What is AuthConfig.cs in ASP.Net MVC ?
A) AuthConfig.cs is used to configure route settings
B) AuthConfig.cs is used to configure security settings including sites oAuth Login.
C) None
D) All
Ans: B
56. What is BundleConfig.cs in ASP.Net MVC ?
A) BundleConfig.cs in MVC is used to register filters for different purposes.
B) BundleConfig.cs in MVC is used to register bundles used by the bundling and minification, serveral bundles are added by default like jQuery, jQueryUI, jQuery validation, Modernizr, default CSS references.
C) All
D) None
Ans: B
57. What is FilterConfig.cs in ASP.Net MVC ?
A) FilterConfig.cs is used to register global MVC filters, HandleErrorAttribute is registered by default filter. We can also register other filters.
B) FilterConfig.cs is used to register global MVC bundles.
C) None
D) All
Ans: A
58. What is RouteConfig.cs in ASP.Net MVC?
A) RouteConfig.cs is used to register MVC config statements, route config.
B) RouteConfig.css is used to register global MVC bundles.
C) None
D) All
Ans: A
59. What is the difference between HtmlTextbox and HtmlTextboxFor using ASP.Net MVC Razor Engine?
A) @Html.TextBox is not strongly typed, @Html.TextBoxFor is strongly typed that is why should be use @Html.TextBoxFor in MVC Razor Engine.
B) @Html.TextBox is strongly typed, @Html.TextBoxFor is not strongly typed that is why should be use @Html.TextBox in MVC Razor Engine.
C) None
D) Both A and B
Ans: A
60. What is the benefits of Html.RenderPartial using ASP.Net MVC Razor Engine?
A) @Html.RenderPartial Returns response, moreover requires to create action.
B) @Html.RenderPartial Returns nothing (void), it is faster than @Html.Partial, moreover requires not to create action.
C) None
D) Both A and B
Ans: B
61. What is the benefits of Html.Partial using ASP.Net MVC Razor Engine?
A) @Html.RenderPartial Returns response, moreover requires to create action.
B) @Html.RenderPartial Returns string value, it is slower than @Html.RenderPartial, moreover requires not to create action.
C) None
D) Both A and B
Ans: B
62. How to check Request coming from which controller using MVC ASP.Net?
A) var _controller = HttpContext.Current.Request.RequestContext.Values[“Controller”].ToString();
B) var _controller = HttpContext.Current.Request.RequestContext.RouteData.Values[“Controller”].ToString();
C) var _controller = RouteData.Values[“Controller”].ToString();
D) None
Ans: B
63. For which ModelState.IsValid Validate ?
A) It checks for Entityframework Model state.
B) It checks for valid Model State using DataAnnotations.
C) It checks for SQL database state.
D) None
Ans: B
64. Which Name space is used to create chart using ASP.Net MVC?
A) using System.Web.MVC;
B) using System.Web.Helpers;
c) using System.Web.Chart;
D) All
Ans: B
65. How can we provide Height and Width to MVC Charts ?
A) new Chart(width – 600, height – 400)
B) new Chart(width = 600, height = 400)
C) new Chart(width: 600, height: 400)
D) All
Ans: C
66. How can we set theme to MVC Charts?
A) new Chart(width: 600, height: 400, theme: ChartTheme.Vanilla3D)
B) new Chart(width: 600, height: 400, theme: ChartTheme = Vanilla3D)
C) new Chart(width: 600, height: 400, theme: Vanilla3D)
D) None
Ans: A
67. How can we give Title to MVC Charts?
A) var chart = AddTitle(“My First Chart”)
B) .AddTitle(“My First Chart”)
C) .AddTitle(‘My First Chart’)
D) All
Ans: B
68. How can we add Series to MVC Charts?
A) .AddSeries(chartType: “Bar”, xValue: xValue, yValues: yValue)
B) .AddSeries(chartType: “Bar”, xValue = xValue, yValues = yValue)
C) .AddSeries(chartType: “Bar”, xValue: xValue, yValues: yValue)
D) None
Ans: A
69. How can we add Chart Type to MVC Charts?
A) .NewSeries(chartType: “Bar”)
B) .Series(chartType: “Bar”)
C) .AddSeries(chartType: “Bar”)
D) All
Ans: C
70. How can we write Chart output to MVC View?
A) .Write(bmp);
B) Write(“bmp”);
C) .Write(“bmp”);
D) All
Ans: C
72. Which name space using can send email in ASP.Net MVC?
A) using System.Net.Mail;
B) using System.Net;
C) using System.Mail;
D) None
Ans: A
73. If Razor View Engine need to add JQuery function and contain @ special character then how we can write it in Razor View?
A) Replace @ to @@@ (tripple)
B) Replace @ to @@ (double)
C) None
D) Both (A & B)
Ans: B
74. How to set Default Value to Hidden Input Box using ASP.Net MVC?
A) @Html.HiddenFor(m => m.Name, “Jack”)
B) @Html.HiddenFor(m => m.Name, new { Value = “Jack”})
C) @Html.Hidden(m => m.Name, new { Value = “Jack”})
D) None
Ans: B
75. How to check all errors of Model using ASP.Net MVC?
A) var errors = Model.Values.SelectMany(v => v.Errors);
B) var errors = ModelState.SelectMany(v => v.Errors);
C) var errors = ModelState.Values.SelectMany(v => v.Errors);
D) None
Ans: C
76. AuthConfig.cs file is under in which App folder ?
A) App_Data
B) App_Start
C) Content
D) Filters
Ans: B
77. BundleConfig.cs file is under in which App folder ?
A) App_Data
B) App_Start
C) Content
D) Filters
Ans: B
78. FilterConfig.cs file is under in which App folder ?
A) App_Data
B) App_Start
C) Content
D) Filters
Ans: B
79. RouteConfig.cs file is under in which App folder ?
A) App_Data
B) App_Start
C) Content
D) Filters
Ans:B
80. WebApiConfig.cs file is under in which App folder ?
A) App_Data
B) App_Start
C) Content
D) Filters
Ans: B
82. Which filter will be execute at first using ASP.Net MVC?
A) Action filters
B) Authorization filters
C) Response filters
D) Exception filters
Ans: B
83. Which filter will be execute at last using ASP.Net MVC?
A) Action filters
B) Authorization filters
C) Exception filters
D) Response filters
Ans: C