Sei sulla pagina 1di 3

MVC & Web API – MCQ

Duration: 30mins
Marks: 20

1) What is strongly typed view in MVC?


a. View created with model
b. View created with strong keyword
c. View created with controller
d. View having same name as class

2) What is the default view engine in MVC?


a. Web Forms(ASPX)
b. Razor View Engine
c. Windows Form
d. HTML

3) Which is the namespace used for MVC?


a. System.Mvc
b. System.Http.Mvc
c. System.Web.Mvc
d. System.Web.Http.Mvc

4) How to enable Attribute Routing in MVC?


a. By adding Routes.MapMvcAttributeRoutes() method in RouteConfig.cs
b. By adding Routes.MapMvcAttributeRoutes() method in BundleConfig.cs
c. By adding Routes.MapMvcRoutes() method in RouteConfig.cs
d. By adding Routes.MapMvcRoutes() method in BindleConfig.cs

5) What are partial views in MVC?


a. Resuable view
b. Same as Master Page in asp.net
c. It is a resource file
d. View that has strongly type model

6) Where the routes registered?


a. Global.asax
b. Web.Config
c. Controller
d. None of the above

7) Which of the following represents razor syntax?


a. *
b. @
c. <%...%>
d. $
8) Which dictionary is used to share data between controller actions?
a. Session
b. TempData
c. ViewData
d. ViewBag

9) What is the difference between ActionResult and ViewResult?


a. ViewResult perform an HTTP redirection to a specific URL
b. ViewResult serialize a given ViewData object to JSON format
c. ActionResult is an abstract class, while ViewResult derives from
ActionResult class
d. ViewResult returns a file to the client

10) Which is not the result in MVC action?


a. ViewResult
b. XMLResult
c. JSONResult
d. EmptyResult

11) Write the correct order for the life cycle of an ASP.NET MVC page a)App
Initialization b)Routing c) Locate and Invoke Controller action
d) Instantiate and execute Controller e) Instantiate and render view

12) Write the correct order of the default route present in RouteConfig.cs
a) Action Name b)Controller Name c) Parameters that passes to the action

13) Which is the valid route definition?


a. {action}/{controller}/{id}
b. {controller}{action}/{id}
c. {action}/{id}/{name}
d. {controller}/{action}/{id}

14) Which of the following are Action Selectors?


a. ActionName
b. NonAction
c. ActionVerbs
d. All the above

15) What is MVC?


a. Model View Condition
b. Modal View Controller
c. Model ViewData Controller
d. Model View Control

16) Which of the following protocol Web API supports?


a. HTTP
b. TCP
c. SOAP
d. FTP
17) Web API Controller must be derived from________?
a. Controller class
b. ApiController class
c. WebApiController class
d. WebController class

18) Which of the following is the Web API response type?


a. HttpMessage
b. IHttpActionResult
c. ActionResult
d. ResposeMessage

19) Which of the following is used to check the validity of the model in Web API?
a. Model.Valid
b. Model.IsValid
c. ModelState.IsValid
d. ModelState.Valid

20) Web API sends which of the following status code on successful execution?
a. 200
b. 404
c. 500
d. 201

Potrebbero piacerti anche