Sei sulla pagina 1di 15

what is strongly typed view in mvc

1. view created with model class

2. view having same name as class

3. view created with strong keyword

4. view created with controller class

What are partial views in MVC

1. Its the resource file for a view

2. View that has strongly-type models

3. Same as MasterPage in asp.net

4. Reusable view

Where are routes registered in ASP.NET MVC Application?

1. Controller

2. Web.Config

3. Global.asax

4. None of the Above

which of the following represents RAZOR syntax?

1. !

2. @

3. <%: %>

4. )

_______ dictionary is used to share data between controller actions

1. Session

2. ViewData

3. ViewBag

4. TempData
What is the difference between “ActionResult” and “ViewResult”?

1. ViewResult performs an HTTP redirection to a specifed URL

2. ViewResult serializes a given ViewData object to JSON format

3. ActionResult is an abstract class while ViewResult derives from ActionResult class

4. ViewResult returns a file to the client, which is provided by a Stream while an ActionResult
performs an HTTP redirection to a specifed URL

Which is not a type of result in MVC

1. ViewResult

2. JsonResult

3. RedirectResult

4. EmptyResult

5. XMLResult

What is the correct order for the lifecycle of an ASP.NET MVC page

1. App initialization
Locate and invoke controller action
Routing
Instantiate and render view
Instantiate and execute controller

2. App initialization
Locate and invoke controller action
Routing
Instantiate and execute controller
Instantiate and render view

3. App initialization
Routing
Instantiate and execute controller
Locate and invoke controller action
Instantiate and render view

4. App initialization
Instantiate and execute controller
Routing
Locate and invoke controller action
Instantiate and render view
5. App initialization
Instantiate and execute controller
Locate and invoke controller action
Routing
Instantiate and render view

What are the 3 segments of the default route, that is present in an ASP.NET MVC
application?

1. 1st Segment - Action Method Name


2nd Segment - Controller Name
3rd Segment - Parameter that is passed to the action method

2. 1st Segment - Action Method Name


2nd Segment - Parameter that is passed to the action method
3rd Segment - Controller Name

3. 1st Segment - Controller Name


2nd Segment - Action Method Name
3rd Segment - Parameter that is passed to the action method

4. 1st Segment - Parameter that is passed to the action method


2nd Segment - Action Method Name
3rd Segment - Controller Name

Is the following route definition a valid route definition?


{controller}{action}/{id}

1. Yes

2. No

Can we map multiple URL’s to the same action

1. Yes

2. No

How can we navigate from one view to other view using hyperlink?

1. TransferLink

2. RedirectLink

3. ActionLink

4. ExecuteLink
public ActionResult Index() {
ViewBag.Message = “Welcome to ASP.NET MVC!”;
return View(“~/Views/Example/Index.cshtml”);
}

Is the return View statement correct?

1. Yes

2. No

Is @Html.Password("txtpassword") the same as <input id="txtpassword"


name="txtpassword" type="text" />

1. False

2. True

Where are the routing rules defined in an asp.net MVC application?

1. In Session_Start event in Global.asax

2. In Application_Start event in Global.asax

3. In the Web.Config under the <system.webServer> section

4. In the Web.Config under the <system.web.webPages.razor> section

By default, ASP.NET MVC looks for the View template file within the \Views\
[ControllerName]\ directory underneath the application.

1. True

2. False

The views for a ProductController reside in /Views/Product folder.

1. True

2. False
The ________ is entirely responsible for interpreting that request, manipulating
the model if necessary, and then selecting a view to send back to the user via the response.

1. Controller

2. View

3. Model

What container is passed between the controller and a view

1. ControllerViewDictionary

2. ViewDataDictionary

3. ModelDataDictionary

Is ViewBag.Message equivalent to ViewData[“Message”].

1. Yes

2. No

@Html.TextBox("name", ViewBag.Name)

Will this work

1. Yes

2. No

public class HomeController : Controller {


public ActionResult Index() {
ViewBag.Message = “Welcome to ASP.NET MVC!”;
return View();
}
}

1. the return will result in an error

2. /Views/Home/Index.cshtml is selected

3. /Views/Home/Home.cshtml is selected

4. /Views/Home/Default.cshtml is selected
Whats the difference between Html.Partial and Html.RenderPartial

1. The RenderPartial helper renders a partial view into a string.

2. The Partial helper renders a partial view into a string.

3. Partial writes directly to the response output stream instead of returning a string

4. RenderPartial writes directly to the response output stream instead of returning a string

5. 2 and 4

Can view data be accessed via the ViewBag property.

1. No

2. Yes

return View();

When the view name isn’t specified as shown below does it first look for a view with the
same name as the action within the /Views/ControllerName directory?

1. True

2. False

The Controller is responsible for providing the user interface (UI) to the user.

1. True

2. False

By default, must all controller classes end with Controller


e.g.
ProductController

1. No

2. Yes
MVC stands for

1. Multiverse-Virtual-Controller

2. Model-View-Controller

3. Master-Value-Construct

4. Mobile-Virtual-Controller

The Model is

1. A set of classes that handles communication from the user, overall application
fl ow, and application-specifi c logic

2. Defi nes how the application’s user interface (UI) will be displayed

3. A set of classes that describes the data you’re working with as well as the business
rules for how the data can be changed and manipulated

Which one is a MVC view engine

1. Blade

2. Shaft

3. Razor

4. Edge

Which feature of ASP.NET MVC allows you to simply pass the ViewModel as a parameter to
the action method without having to tear off the individual parameters from the Form?

1. Media Queries

2. Data Binding

3. Session

4. Model Binding
What are the advantages of ASP.NET MVC?

1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.

2. Seperation of concerns. Different aspects of the application can be divided into Model,
View and Controller.

3. ASP.NET MVC views are light weight, as they do not use viewstate.

4. It does not use view state on server-based forms which gives more control over the
behavior of an application

5. answer 1,2,3,4

Is it possible to unit test an MVC application without running the controllers in an ASP.NET
process?

1. Yes

2. No

Is it possible to share a view across multiple controllers?

1. Yes

2. No

How can we maintain session in MVC

1. tempdata

2. viewdata

3. viewbag

4. viewstate

5. 1,2 and 3

6. 2,3 and 4
ASP.NET MVC application, makes use of settings for routing to work correctly. Which file/s
need to be altered for routing to work

1. Web.Config File

2. Global.asax File

3. Both 1 & 2

4. none of the above

Can we do validation in MVC using data annotations

1. Yes

2. No

Which of the below are return types of a controller action method

1. ViewResult

2. JavaScriptResult

3. RedirectResult

4. ContentResult

5. All the above

Can you point your browser to a view and have it render

1. Yes

2. No

Is there any way to handle variable number of segments in a route definition ?

1. No

2. controller/{action}/{*parametervalues}

3. controller/{action}/{?parametervalues}

4. controller/{action}/{ALLparametervalues}
Can can we plug an ASP.NET MVC into an existing ASP.NET application

1. Yes, no changes are needed

2. No

3. Yes, some modification is needed

Which method marks the specified key in a TempData dictionary for retention

1. TempData.Revive()

2. TempData.Alive()

3. TempData.Increase()

4. TempData.Load()

5. TempData.Store()

6. TempData.Keep()

In an ASP .Net MVC Application, browsers requests are mapped to?

1. Pages

2. Controller

3. Model

4. All of the above

5. None of the above

Not all views render HTML.

1. False

2. True
MVC stands for ______.

1. Model, Vision & Control


2. Model, View & Controller
3. Model, ViewData & Controller
4. Model, Data & Controller

Correct Answer: Model, View & Controller

Which of following is TRUE?

1. The controller redirects incoming request to model.


2. The controller executes an incoming request.
3. The controller controls the data.
4. The controller render html to view.

Correct Answer: The controller executes an incoming request.

The model is a _______ .

1. Shape of data.
2. Html content
3. Collection of data
4. Type of data.

Correct Answer: Shape of data.

Which of the following is a type of view in MVC?

1. Partial view
2. Executable view
3. Data view
4. Designer view

Correct Answer: Partial view

Which of the following is TRUE?

1. Action method can be static method in a controller class.


2. Action method can be private method in a controller class.
3. Action method can be protected method in a controller class.
4. Action method must be public method in a controller class.

Correct Answer: Action method must be public method in a controller class.


Which of the followings are ActionSelectors?

1. ActionName
2. NonAction
3. ActionVerbs
4. All of the above

Correct Answer: All of the above

Which is the default http method for an action method?

1. HttpPost
2. HttpGet
3. HttpPut
4. HttpDelete

Correct Answer: HttpGet

Which of the following view file types are supported in MVC?

1. .cshtml
2. .vbhtml
3. .aspx
4. All of the above

Correct Answer: All of the above

HtmlHelper class _________.

1. Generates html elements


2. Generates html view
3. Generates html help file
4. Generates model data

Correct Answer: Generates html elements

______ attributes can be used for data validation in MVC.

1. DataAnnotations
2. Fluent API
3. DataModel
4. HtmlHelper

Correct Answer: DataAnnotations


Which of the following view contains common parts of UI?

1. Partial view
2. Html View
3. Layout view
4. Razor view

Correct Answer: Layout view

Which of the following methods are used to render partial view?

1. Html.Partial()
2. Html.RenderPartial()
3. Html.RenderAction()
4. All of the above

Correct Answer: All of the above

How to transfer data from controller to view?

1. Using model object


2. Using ViewBag
3. Using ViewData
4. All of the above

Correct Answer: All of the above

TempData is useful to _______.

1. Transfer data from view to controller


2. Transfer data from one view to another view
3. Transfer data from controller to controller
4. Store data permanently.

Correct Answer: Transfer data from one view to another view

What is action filters?

1. Action filter executes before and after action method executes.


2. Action filter executes before action method executes.
3. Action filter executes after action method executes.
4. Action filter executes parallel to action method.

Correct Answer: Action filter executes before and after action method
executes.
Bundling allows __________.

1. Loading of multiple images in single request.


2. Loading of multiple view files in single request.
3. Loading of caching of multiple script files.
4. Loading of multiple script files in single request.

Correct Answer: Loading of multiple script files in single request.

Area allows us to ____________.

1. Partition large application into smaller units.


2. Separate Mode, View and Controller folders.
3. Partition View folder of large application into multiple view folders
4. All of the above

Correct Answer: Partition large application into smaller units.

Which of the following is a default route pattern in MVC?

1. "/{action}/{controller}/{id}"
2. "{controller}/{id}"
3. "{controller}/{action}/{id}"
4. "{controller}/{action}”

Correct Answer: "{controller}/{action}/{id}"

Which of the following default class is used to configure all the routes in MVC?

1. FilterConfig
2. RegisterRouteConfig
3. RouteConfig
4. MVCRoutes

Correct Answer: RouteConfig

Which of the following method of html helper generates html control based on
the data type of specified property?

1. Html.TextBox
2. Html.Password
3. Html.Editor
4. Html.Display

Correct Answer: Html.Editor

Potrebbero piacerti anche