Tuesday 24 January 2017

MVC interview questions for 5 years experience, mvc interview questions and answers for experienced in .net pdf, mvc interview questions and answers for 3 years experience, java mvc interview questions, php mvc interview questions, asp.net mvc interview questions and answers for 4 years experience, mvc application life cycle, web api interview questions and answers for experienced, Most Asked ASP.NET MVC Interview Questions and Answers, ASP.NET MVC Interview Questions, ASP.NET MVC interview questions with answers

This article will Help you how to quick and easy learn the basics of MVC along with some frequently asked interview questions and answers on ASP.Net MVC.
ASP.Net MVC Interview Questions and Answers
1. What is ASP.Net MVC
The ASP.Net MVC is the framework provided by Microsoft to achieve     separation of concerns that leads to easy maintainability of the     application.
Model is supposed to handle data related activity
View deals with user interface related work
Controller is meant for managing the application flow by communicating between Model and View.

2. Why to use ASP.Net MVC
The strength of MVC (i.e. ASP.Net MVC) is listed below, that will answer this question
MVC reduces the dependency between the components; this makes your code more testable.
MVC does not recommend use of server controls, hence the processing time required to generate HTML response is drastically reduced.
The integration of java script libraries like jQuery, Microsoft MVC becomes easy as compared to Webforms approach.

3. What do you mean by Razor
The Razor is the new View engine introduced in MVC 3.0.
The View engine is responsible for processing the view files [e.g. .aspx, .cshtml] in order to generate HTML response.
The previous versions of MVC were dependent on ASPX view engine.

4. Can we use ASPX view engine in latest versions of MVC
Yes. The Recommended way is to prefer Razor View

5. What are the benefits of Razor View?
     The syntax for server side code is simplified
     The length of code is drastically reduced
     Razor syntax is easy to learn and reduces the complexity

6. What is the extension of Razor View file?
.cshtml (for c#) and .vbhtml (for vb)

7. How to create a Controller in MVC
Create a simple class and extend it from Controller class. The bare minimum requirement for a class to become a controller is to inherit it from ControllerBase is the class that is required to inherit to create the controller but Controller class inherits from ControllerBase.

8. How to create an Action method in MVC
Add a simple method inside a controller class with ActionResult return type.

9. How to access a view on the server
The browser generates the request in which the information like Controller name, Action Name and Parameters are provided, when server receives this URL it resolves the Name of Controller and Action, after that it calls the specified action with provided parameters. Action normally does some processing and returns the ViewResult by specifying the view name (blank name searches according to naming conventions).

10. What is the default Form method (i.e. GET, POST) for an action method
GET. To change this you can add an action level attribute e.g [HttpPost]

11. What is a Filter in MVC?
When user (browser) sends a request to server an action method of a controller gets invoked; sometimes you may require executing a custom code before or after action method gets invoked, this custom code is called as Filter.

12. What are the different types of Filters in MVC?
a. Authorization filter
b. Action filter
c. Result filter
d. Exception filter
[Do not forget the order mentioned above as filters gets executed as per above mentioned sequence]

13. Explain the use of Filter with an example?
Suppose you are working on a MVC application where URL is sent in an encrypted format instead of a plain text, once encrypted URL is received by server it will ignore action parameters because of URL encryption.
To solve this issue you can create global action filter by overriding OnActionExecuting method of controller class, in this you can extract the action parameters from the encrypted URL and these parameters can be set on filterContext to send plain text parameters to the actions.  

14. What is a HTML helper?
A HTML helper is a method that returns string; return string usually is the HTML tag. The standard HTML helpers (e.g. Html.BeginForm(),Html.TextBox()) available in MVC are lightweight as it does not rely on event model or view state as that of in ASP.Net server controls.

4 comments:

  1. Hello Raju,

    Amaze! I have been looking bing for hours because of this and I also in the end think it is in this article! Maybe I recommend you something helps me all the time?
    I am trying to scraping a web-site using Jsoup.
    These techniques are applied at JVM Level. In general, they deal in configuring various parameters that are exposed by JVM implementation. These techniques are non -invasive in nature. Some of them are pretty trivial to use and do not require any special expertise hence having low complexity and ease of identifications.
    I have Login successfully and while move to the next page (Result page) the data are loading by Restful web-service as JSON. need to pass the cookies and secret keys too.
    12.Is it possible to read web-service using Jsoup?
    import java.util.*;
    public class AddStuff {
    public static double addUp(List addfrom) {
    double counter=0.0;
    for (Number n : addfrom) {
    counter+=n.doubleValue();
    }
    return counter;
    }
    public static void main(String[] args) {
    List addfrom = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
    double sum=addUp(addfrom);
    System.out.println(sum);
    }
    }
    Great effort, I wish I saw it earlier. Would have saved my day.

    Ciao,
    Sam

    ReplyDelete
  2. Hello Mate,

    You make learning and reading addictive. All eyes fixed on you. Thank you being such a good and trust worthy guide.

    I want to display tree grid which contain tab details like the attachment. Means when user click on any tree grid item then he will get expanded result in tab format like this which you can see in attached documents

    Awesome! Thanks for putting this all in one place. Very useful!


    Many Thanks,
    Morgan

    ReplyDelete


  3. My name is Leah Brown, I'm a happy woman today? I told myself that any loan lender that could change my life and that of my family after having been scammed separately by these online loan lenders, I will refer to anyone who is looking for loan for them. It gave me and my family happiness, although at first I had a hard time trusting him because of my experiences with past loan lenders, I needed a loan of $300,000.00 to start my life everywhere as single mother with 2 children, I met this honest and God fearing online loan lender Gain Credit Loan who helped me with a $300,000.00 loan, working with a loan company Good reputation. If you are in need of a loan and you are 100% sure of paying the loan please contact (gaincreditloan1@gmail.com)

    ReplyDelete
  4. PokerStars - Gaming & Slots at Aprcasino
    Join the communitykhabar fun at Aprcasino and play https://access777.com/ the casino-roll.com best of the best PokerStars casino games including Slots, Blackjack, 토토 Roulette, Video Poker and more! apr casino

    ReplyDelete