MVC Interview questions and answers


MVC Interview Questions and Answers  

MVC Interview questions and answers

MVC 5 Interview Questions (For More Details)
MVC 4 Interview Questions (For More)


 Whatis is  ASP.NET MVC Stands for ?

It divides your application into three components. Namely Model, View & Controller. 
i) Model : It is responsible Business object and Database Actions.
ii) Views : It is responsible for user interface of the application.
iii) Controller : It is responsible for User Interface, user interaction and manipulating the model.


MVC Architecture

2) what is the namespace you have to use for MVC ?
Ans:) System.Web.Mvc assembly It contains support classes and interfaces for MVC framework (Model, View & Controller (MVC) framework)

3) What is engine in ASP.NET MVC ? What are different engines are avaible ?
Engine is parser for your code. There are two type of engines avaible. You can choose any one.

  1. ASPX Engine

  2. Rajor Engine

4) What is the difference between these two engines ?
Ans:) you can use any of the engine to develop a MVC application. The difference you can find in Syntax.

Note: The Most used engine is Rajor and Intraduced from MVC onwards.

Print date using ASPX engine Syntax: (It is similar like ASP.NET webforms syntax)

<%: DateTime.Now %> (Instead of equals to ‘=’ use ‘:’ isto symbol)
<% %> use these symbols for multiline.

Print date using Rajor engine Syntax. it is Most widely used


5) What is routing in Asp.Net MVC and ASP.NET web forms ?
Ans:) Routing is configuration setting to format URL. You can configure URL of your choice those setting you have to set in Global.asax

In if you want send values to antoher page one of the soultion is Query String
for example I want to send Id form Page1.aspx to page2.aspx then I have to write like below

Samething in MVC you can send like this.


public class RouteConfig
    public static void RegisterRoutes(RouteCollection routes)

            name: “Default”,
            url: “{controller}/{action}/{id}”,
            defaults: new {
                controller = “Home”,
                action = “Index”,
                id = UrlParameter.Optional }

MVC Interview Questions and answers Routing Config

In example above example

  • Page is controller
  • Id is Action is
  • 10 is the value

 6) Why I am not able to see the page name like in ? Why in above example MVC like format without page name ?

Ans:) It is because of routing. In MVC you can format your URL by using routing concept.

7) what is the System.Web.Routing namespace ?
Ans:) In Asp.Net MVC you can take help of routing by using Systemd.web.Routing.

8) What is the important character you have to use in MVC ?
Ans:) ‘@’ is the very important character for Razor Syntax.

@{ } this block is for multiple line of server side code to write

9) What are the very important concepts to learn in MVC ?
Ans:) ASP.NET MVC 3 Helpers, Forms and Validation

10) What are the important concepts to lean in MVC


  • ASP.NET MVC 3 Helpers

  • Forms and Validations

  • Routing In MVC

  • Security In MVC

11) In Asp.Net my page extention is .aspx (like Default.aspx) then what is my page extention here ? Where I have to write HTML tags ?

Ans:) You extension here is cshtml. In cshtml you have to wirte the mark up language.

12) In Model, View & Controller which one is best to create first  ?

Ans:) It is best to create Model.

13) In MVC can I create automatically generate the CRUD operations ?

Ans:) Yes If you define Model first you can generate actions automatically.

14) Can I create the CsHtml pages from Controller ?

Ans:) Yes. You have a option to create View pages from Controller

 MVC interview Questions and answers on Helper classes

15) Can I access Model in CSHTML page

Yes. You can you access Model in CsHtml Pae.

16) What are the helper classes ?

Instead of writing Input tag you take help of Helper classes. For your understanding these are alike ASP.NET Server controls. However these have there are lot differences between ASP.NET webforms server controls like Textbox, Dropdown etc..

17) How can you use helper classes with combination of Model

<% foreach (var item in Model) { %>   
         <td> <%: Html.ActionLink(“Edit”, “Edit”, new { id=item.AlbumId }) %> |    
             <%: Html.ActionLink(“Delete”, “Delete”, new { id=item.AlbumId })%>     
       <td><%: Html.Truncate(item.Title, 25) %></td>
        <td><%: Html.Truncate(item.Artist.Name, 25) %></td>
        <td><%: item.Genre.Name %></td>  
 </tr><% } %> 

 More question will be availblable soon.. keep in touch with

For More on – MVC Interview questions and answers (Internal)
Fore More on – MVC Interview questions and answers (External)