Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5fe2bb8

Browse files
Update README.md
1 parent 1bcf072 commit 5fe2bb8

File tree

1 file changed

+289
-6
lines changed

1 file changed

+289
-6
lines changed

‎README.md

Lines changed: 289 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,299 @@
1-
# Angular Interview Questions & Answers
1+
# ASP.NET MVC Interview Questions & Answers
22

33
> Click :star:if you like the project. Pull Request are highly appreciated. Follow me [@kansiris87](https://twitter.com/kansiris87) for technical updates.
44
55
### Table of Contents
66

77
| No. | Questions |
88
|---- | ---------
9-
|1 | [What is Angular Framework?](#what-is-angular-framework)|
10-
|2 | [What is the difference between AngularJS and Angular?](#what-is-the-difference-between-angularjs-and-angular)|
11-
|3 | [What is TypeScript?](#what-is-typescript)|
12-
|4 | [Write a pictorial diagram of Angular architecture?](#write-a-pictorial-diagram-of-angular-architecture)|
13-
|5 | [What are the key components of Angular?](#what-are-the-key-components-of-angular)|
9+
|1 | [What is Layout in MVC?](#What-is-Layout-in-MVC?)|
10+
|2 | [What are Actions in MVC?](#What-are-Actions-in-MVC?)|
11+
|3 | [What is Razor View Engine?](#What-is-Razor-View-Engine?)|
12+
|4 | [What is the use of ViewModel in MVC?](#What-is-the-use-of-ViewModel-in-MVC?)|
13+
|5 | [What you mean by Routing in MVC?](#What-you-mean-by-Routing-in-MVC?)|
14+
|6 | [What are the advantages of MVC over ASP.NET?](#What-are-the-advantages-of-MVC-over-ASP.NET?)|
15+
|7 | [What are Scaffold templates in MVC?](#What-are-Scaffold-templates-in-MVC?)|
16+
|8 | [Explain Bundle.Config in MVC4?](#Explain-Bundle.Config-in-MVC4?)|
17+
|9 | [Can you explain Model, Controller and View in MVC?](#Can-you-explain-Model,-Controller-and-View-in-MVC?)|
18+
|10| [Explain Sections is MVC?](#Explain-Sections-is-MVC??)|
19+
|1 | [What are Non Action methods in MVC?](#What-are-Non-Action-methods-in-MVC?)|
20+
|2 | [What is RouteConfig.cs in MVC 4?](#What-is-RouteConfig.cs-in-MVC-4?)|
21+
|3 | [What is the difference between ViewBag and ViewData in MVC?](#What-is-the-difference-between-ViewBag-and-ViewData-inMVC?)|
22+
|4 | [What is the "HelperPage.IsAjax" Property?](#What-is-the-"HelperPage.IsAjax"-Property?)|
23+
|5 | [What are HTML Helpers in MVC?](#What-are-HTML-Helpers-in-MVC?)|
24+
|6 | [Can you explain the page life cycle of MVC?](#Can-you-explain-the-page-life-cycle-of-MVC?)|
25+
|7 | [What is Attribute Routing in MVC?](#What-is-Attribute-Routing-in-MVC?)|
26+
|8 | [What is PartialView in MVC?](#What-is-PartialView-in-MVC?)|
27+
|9 | [Can you explain RenderBody and RenderPage in MVC?](#Can-you-explain-RenderBody-and-RenderPage-in-MVC?)|
28+
|10| [Explain the methods used to render the views in MVC?](#Explain-the-methods-used-to-render-the-views-in-MVC?)|
29+
|1 | [Explain ASP.NET WebApi vs MVC?](#Explain-ASP.NET-WebApi-vs-MVC?)|
30+
|2 | [Can a view be shared across multiple controllers? If Yes, How we can do that?](#Can-a-view-be-shared-across-multiple-controllers?- If-Yes,-How-we-can-do-that?)|
31+
|3 | [Explain TempData in MVC?](#Explain-TempData-in-MVC?)|
32+
|4 | [What are Validation Annotations?](#What-are-Validation-Annotations?)|
33+
|5 | [Why to use Html.Partial in MVC?](#Why-to-use-Html.Partial-in-MVC?)|
34+
|6 | [How route table has been created in ASP.NET MVC?](#How-route-table-has-been-created-in-ASP.NET-MVC?)|
35+
|7 | [Explain Dependency Resolution?](#Explain-Dependency-Resolution?)|
36+
|8 | [What is Separation of Concerns in ASP.NET MVC?](#What-is-Separation-of-Concerns-in-ASP.NET-MVC?)|
37+
|9 | [What are AJAX Helpers in MVC?](#What-are-AJAX-Helpers-in-MVC?)|
38+
|10| [What is Html.RenderPartial?](#What-is-Html.RenderPartial?)|
39+
40+
41+
42+
43+
44+
What is Layout in MVC?
45+
Layout pages are similar to master pages in traditional web forms. This is used to set the common look across multiple pages. In each child page we can find —
46+
47+
@{
48+
Layout = "~/Views/Shared/TestLayout1.cshtml";
49+
}
50+
This indicates child page uses TestLayout page as it’s master page.
51+
52+
Source
53+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
54+
[] Back to top
55+
56+
What are Actions in MVC?
57+
Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type — "ActionResult" and it will be invoked from method — "InvokeAction()" called by controller.
58+
59+
Source
60+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
61+
[] Back to top
62+
63+
What is Razor View Engine?
64+
Razor is the first major update to render HTML in MVC 3. Razor was designed specifically for view engine syntax. Main focus of this would be to simplify and code-focused templating for HTML generation. Below is the sample of using Razor:
65+
66+
@model MvcMusicStore.Models.Customer
67+
@{ViewBag.Title = "Get Customers";}
68+
<div class="cust"> <h3><em>@Model.CustomerName</em> </h3>
69+
Source
70+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
71+
[] Back to top
72+
73+
What is the use of ViewModel in MVC?
74+
ViewModel is a plain class with properties, which is used to bind it to strongly typed view. ViewModel can have the validation rules defined for its properties using data annotations.
75+
76+
Source
77+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
78+
[] Back to top
79+
80+
What you mean by Routing in MVC?
81+
Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class — "UrlRoutingModule" is used for the same process.
82+
83+
Source
84+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
85+
[] Back to top
86+
87+
What are the advantages of MVC over ASP.NET?
88+
Provides a clean separation of concerns among UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller).
89+
Easy to UNIT Test
90+
Improved reusability of model and views. We can have multiple views which can point to the same model and vice versa.
91+
Improved structuring of the code
92+
Source
93+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
94+
[] Back to top
95+
96+
What are Scaffold templates in MVC?
97+
Scaffolding in ASP.NET MVC is used to generate the Controllers, Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views.
98+
99+
Source
100+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
101+
[] Back to top
102+
103+
Explain Bundle.Config in MVC4?
104+
"BundleConfig.cs" in MVC4 is used to register the bundles by the bundling and minification system. Many bundles are added by default including jQuery libraries like — jquery.validate, Modernizr, and default CSS references.
105+
106+
Source
107+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
108+
[] Back to top
109+
110+
Can you explain Model, Controller and View in MVC?
111+
Model — It’s a business entity and it is used to represent the application data.
112+
Controller — Request sent by the user always scatters through controller and it’s responsibility is to redirect to the specific view using View() method.
113+
View — It’s the presentation layer of MVC.
114+
Source
115+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
116+
[] Back to top
117+
118+
Explain Sections is MVC?
119+
Section are the part of HTML which is to be rendered in layout page. In Layout page we will use the below syntax for rendering the HTML –
120+
121+
@RenderSection("TestSection")
122+
And in child pages we are defining these sections as shown below –
123+
124+
@section TestSection{
125+
<h1>Test Content</h1>
126+
}
127+
Source
128+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
129+
[] Back to top
130+
131+
What are Non Action methods in MVC?
132+
In MVC all public methods have been treated as Actions. So if you are creating a method and if you do not want to use it as an action method then the method has to be decorated with "NonAction" attribute as shown below:
133+
134+
[NonAction]
135+
public void TestMethod()
136+
{
137+
// Method logic
138+
}
139+
Source
140+
https://stackoverflow.com/questions/21758615/why-should-i-use-ihttpactionresult-instead-of-httpresponsemessage
141+
[] Back to top
142+
143+
What is RouteConfig.cs in MVC 4?
144+
"RouteConfig.cs" holds the routing configuration for MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax.
145+
146+
Source
147+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
148+
[] Back to top
149+
150+
What is the difference between ViewBag and ViewData in MVC?
151+
ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be:
152+
153+
In ViewBag no need to typecast the objects as in ViewData.
154+
ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData.
155+
Source
156+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
157+
[] Back to top
158+
159+
What is the "HelperPage.IsAjax" Property?
160+
The HelperPage.IsAjax property gets a value that indicates whether Ajax is being used during the request of the Web page.
161+
162+
Source
163+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
164+
[] Back to top
165+
166+
What are HTML Helpers in MVC?
167+
HTML Helpers are like controls in traditional web forms. But HTML helpers are more lightweight compared to web controls as it does not hold viewstate and events. HTML Helpers returns the HTML string which can be directly rendered to HTML page. Custom HTML Helpers also can be created by overriding "HtmlHelper" class.
168+
169+
Source
170+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
171+
[] Back to top
172+
173+
Can you explain the page life cycle of MVC?
174+
Below are the processed followed in the sequence:
175+
176+
App initialization
177+
Routing
178+
Instantiate and execute controller
179+
Locate and invoke controller action
180+
Instantiate and render view
181+
Source
182+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
183+
[] Back to top
184+
185+
What is Attribute Routing in MVC?
186+
ASP.NET Web API supports this type routing. This is introduced in MVC5. In this type of routing, attributes are being used to define the routes. This type of routing gives more control over classic URI Routing. Attribute Routing can be defined at controller level or at Action level like –
187+
188+
[Route("{action = TestCategoryList}")] — Controller Level
189+
[Route("customers/{TestCategoryId:int:min(10)}")] — Action Level
190+
Source
191+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
192+
[] Back to top
193+
194+
What is PartialView in MVC?
195+
PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it's been shared with multiple views these are kept in shared folder. Partial Views can be rendered in following ways –
196+
197+
Html.Partial()
198+
Html.RenderPartial()
199+
Source
200+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
201+
[] Back to top
202+
203+
Can you explain RenderBody and RenderPage in MVC?
204+
RenderBody is like ContentPlaceHolder in web forms. This will exist in layout page and it will render the child pages/views. Layout page will have only one RenderBody() method. RenderPage also exists in Layout page and multiple RenderPage() can be there in Layout page.
205+
206+
Source
207+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
208+
[] Back to top
209+
210+
Explain the methods used to render the views in MVC?
211+
Below are the methods used to render the views from action:
212+
213+
View() — To return the view from action.
214+
PartialView() — To return the partial view from action.
215+
RedirectToAction() — To Redirect to different action which can be in same controller or in different controller.
216+
Redirect() — Similar to "Response.Redirect()" in webforms, used to redirect to specified URL.
217+
RedirectToRoute() — Redirect to action from the specified URL but URL in the route table has been matched.
218+
Source
219+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
220+
[] Back to top
221+
222+
Explain ASP.NET WebApi vs MVC?
223+
Usually, WebAPI used for data services where MVC can generate more types of outputs (like template HTML views).
224+
225+
WebAPI simplifies the way we can create REST data services. It's clean and easy for this purpose.
226+
MVC can generate any output WebAPI can output. Generating outputs from templates can be easily achieved in MVC. I can't find a reason to do so in WebAPI.
227+
Source
228+
https://stackoverflow.com/questions/19336347/what-is-the-difference-between-a-web-api-and-a-web-service
229+
[] Back to top
230+
231+
Can a view be shared across multiple controllers? If Yes, How we can do that?
232+
Yes, we can share a view across multiple controllers. We can put the view in the "Shared" folder. When we create a new MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages.
233+
234+
Source
235+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
236+
[] Back to top
237+
238+
Explain TempData in MVC?
239+
TempData is again a key, value pair as ViewData. This is derived from "TempDataDictionary" class. TempData is used when the data is to be used in two consecutive requests, this could be between the actions or between the controllers. This requires typecasting in view.
240+
241+
Source
242+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
243+
[] Back to top
244+
245+
What are Validation Annotations?
246+
Data annotations are attributes which can be found in the "System.ComponentModel.DataAnnotations" namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes — Required, String Length, Regular Expression and Range are used to cover the common validation scenarios.
247+
248+
Source
249+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
250+
[] Back to top
251+
252+
Why to use Html.Partial in MVC?
253+
This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods. We can use this like below:
254+
255+
@Html.Partial("TestPartialView")
256+
Source
257+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
258+
[] Back to top
259+
260+
How route table has been created in ASP.NET MVC?
261+
Method — "RegisterRoutes()" is used for registering the routes which will be added in "Application_Start()" method of global.asax file, which is fired when the application is loaded or started.
262+
263+
Source
264+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
265+
[] Back to top
266+
267+
Explain Dependency Resolution?
268+
Dependency Resolver has been introduced in MVC3 and it is greatly simplified the use of dependency injection in your applications. This turn to be easier and useful for decoupling the application components and making them easier to test and more configurable.
269+
270+
Source
271+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
272+
[] Back to top
273+
274+
What is Separation of Concerns in ASP.NET MVC?
275+
It’s is the process of breaking the program into various distinct features which overlaps in functionality as little as possible. MVC pattern concerns on separating the content from presentation and data-processing from content.
276+
277+
Source
278+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
279+
[] Back to top
280+
281+
What are AJAX Helpers in MVC?
282+
AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs the request asynchronously and these are extension methods of AJAXHelper class which exists in namespace — System.Web.Mvc.
283+
284+
Source
285+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
286+
[] Back to top
287+
288+
What is Html.RenderPartial?
289+
Result of the method — "RenderPartial" is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls "Write()" internally and we have to make sure that "RenderPartial" method is enclosed in the bracket.
290+
291+
Source
292+
https://medium.com/dot-net-tutorial/top-50-asp-net-mvc-interview-questions-with-answers-1fd9b1638c61
293+
[] Back to top
294+
295+
296+
14297

15298

16299
1. ### What is Angular Framework?

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /