1) Mention what is the difference between “ActionResult” and “ViewResult” ?
“ActionResult” is an abstract class while “ViewResult” is derived from “AbstractResult” class. “ActionResult” has a number of derived classes like “JsonResult”, “FileStreamResult” and “ViewResult” .
“ActionResult” is best if you are deriving different types of view dynamically.
2) Mention the advantages and disadvantages of MVC model?
3) Explain what is routing? What are the three segments for routing is important?
Routing helps you to decide a URL structure and map the URL with the Controller.
The three segments that are important for routing is
There is a group of routes called the RouteCollection, which consists of registered routes in the application. The RegisterRoutes method records the routes in this collection. A route defines a URL pattern and a handler to use if the request matches the pattern. The first parameter to the MapRoute method is the name of the route. The second parameter will be the pattern to which the URL matches. The third parameter might be the default values for the placeholders if they are not determined.
5) Explain using hyperlink how you can navigate from one view to other view?
By using “ActionLink” method as shown in the below code. The below code will make a simple URL which help to navigate to the “Home” controller and invoke the “GotoHome” action.
Collapse / Copy Code
<%= Html.ActionLink(“Home”, “Gotohome”) %>
6) Mention how can maintain session in MVC?
Session can be maintained in MVC by three ways tempdata, viewdata, and viewbag.
7) Mention what is the difference between Temp data, View, and View Bag?
Partial view in MVC renders a portion of view content. It is helpful in reducing code duplication. In simple terms, partial view allows to render a view within the parent view.
9) Explain how you can implement Ajax in MVC?
In Ajax, MVC can be implemented in two ways
The steps for the execution of an MVC project includes
In order to send the result back in JSON format in MVC, you can use “JSONRESULT” class.
12) Explain what is the difference between View and Partial View?
Tags: ASP.NET MVC Interview Questions and Answers At Infosys, Infosys, Interview Questions and Answers At Infosys, ASP.NET MVC, ASP.NET MVC Interview Questions, ASP.NET MVC QA, ASP.NET MVC Interview Questions and Answers, ASP.NET MVC Tutorial, ASP.NET MVC books, ASP.NET MVC Interview Questions pdf, ASP.NET MVC experienced QA, interview questions, ASP.NET MVC interview questions for experienced, ASP.NET MVC interview questions for developers,ASP.NET MVC interview questions for freshers,ASP.NET MVC interview questions senior level, ASP.NET MVC Certification Questions, Basic ASP.NET MVC interview questions, ASP.NET MVC interview questions 2 3 4 5 6 years experienced, ASP.NET MVC Real time interview questions, ASP.NET MVC Interview Questions and Answers At Infosys 2015, Latest ASP.NET MVC Questions At Infosys Interview.
“ActionResult” is an abstract class while “ViewResult” is derived from “AbstractResult” class. “ActionResult” has a number of derived classes like “JsonResult”, “FileStreamResult” and “ViewResult” .
“ActionResult” is best if you are deriving different types of view dynamically.
2) Mention the advantages and disadvantages of MVC model?
Advantages | Disadvantages |
|
|
3) Explain what is routing? What are the three segments for routing is important?
Routing helps you to decide a URL structure and map the URL with the Controller.
The three segments that are important for routing is
- ControllerName
- ActionMethodName
- Parameter
There is a group of routes called the RouteCollection, which consists of registered routes in the application. The RegisterRoutes method records the routes in this collection. A route defines a URL pattern and a handler to use if the request matches the pattern. The first parameter to the MapRoute method is the name of the route. The second parameter will be the pattern to which the URL matches. The third parameter might be the default values for the placeholders if they are not determined.
5) Explain using hyperlink how you can navigate from one view to other view?
By using “ActionLink” method as shown in the below code. The below code will make a simple URL which help to navigate to the “Home” controller and invoke the “GotoHome” action.
Collapse / Copy Code
<%= Html.ActionLink(“Home”, “Gotohome”) %>
6) Mention how can maintain session in MVC?
Session can be maintained in MVC by three ways tempdata, viewdata, and viewbag.
7) Mention what is the difference between Temp data, View, and View Bag?
- Temp data: It helps to maintain data when you shift from one controller to other controller.
- View data: It helps to maintain data when you move from controller to view
- View Bag: It’s a dynamic wrapper around view data
Partial view in MVC renders a portion of view content. It is helpful in reducing code duplication. In simple terms, partial view allows to render a view within the parent view.
9) Explain how you can implement Ajax in MVC?
In Ajax, MVC can be implemented in two ways
- Ajax libraries
- Jquery
The steps for the execution of an MVC project includes
- Receive first request for the application
- Performs routing
- Creates MVC request handler
- Create Controller
- Execute Controller
- Invoke action
- Execute Result
In order to send the result back in JSON format in MVC, you can use “JSONRESULT” class.
12) Explain what is the difference between View and Partial View?
View | Partial View |
|
|
1 comments:
Write commentsMVC is a framework pattern that splits an application’s implementation logic into three component roles: models, views, and controllers.mvc interview questions
Reply