Showing posts with label Top 10 Interview Question & Answers. Show all posts
Showing posts with label Top 10 Interview Question & Answers. Show all posts

Wednesday, April 1, 2020

Top 10 ASP.NET MVC Interview Q & A

1. What is ASP.NET MVC ?

ASP.NET MVC is a web application framework. it is lightweight and highly testable framework. MVC separate application into three components- Model, View and Controller.

2. Can you explain Model, View and Controller in MVC ?

Model - its business entity and it is used to represent the application data.
Controller - request sent by the user always scatters through controller and its responsibility is to redirect to the specific view using View() method.
View- if the presentation layer of MVC.

3. Explain the new features added in version 4 of MVC( MVC4) ?

following features added newly-
Asynchronous controller task support
building the JavaScript.
segregating the config for MVC routing, Web API, Bundle etc.
mobile templates.
added ASP.NET Web API template for creating REST based services.
Bundling the JavaScript .

4. Can you explain the page life cycle of MVC ?

below are the process followed in the sequence -
App initialisation
Routing
Instantiate and execute controller
Locate and invoke controller action
Instantiate and render view 

5. what are the advantages of MVC over ASP.NET ?

Provides a clean separation of concerns among UI ( Presentation layer), model ( Transfer objects / Domain objects/ Entities) and Business logic ( Controller).
Easy to UNIT test.
improved reusability of model and views. we can have multiple views which can point to the same model and vice versa .
improved structuring of the code.

6. what is separation of concerns in ASP.NET MVC?

it's the process of breaking the program into various resident features which overlaps in functionality as little as possible. MVC pattern concerns on separating the content from presentation and data processing from content.

7. what is Razor View Engine ?

Razor is the first major update to render HTML in MVC 3. razor was designed specifically for view engine syntax. main purpose of this would be to simplify and code for girls templating for HTML generation. below is the sample of using razor:
@model MvcMusicStore.Models.Customer

@{ViewBag.Title = “Get Customers”;}

<div class=”cust”> <h3><em>@Model.CustomerName</em> </h3>

8. What is the meaning of Unobtrusive JavaScript ?

this is a General term that conveys general philosophy, similar to the term REST ( Representational State Transfer) . Unobtrusive JavaScript code in your page markup.

Example: instead of using events like onclick and onsubmit, Unobtrusive JavaScript attaches to Elements by their ID or class based on the HTML5 data attributes. in a line

9. what is the use of ViewModel in MVC ?

ViewModel is a plane class with properties, which is used to bind it too strongly typed view. ViewModel can have the validation rules defined for its properties using the data annotations.

10. what do you mean by Routing in MVC ?

routing is a pattern matching mechanism of incoming request to the URL pattern which are registered in route table. Class- “URLRoutingModule” is used for the same process.

11. What are actions in MVC ?


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 in work from method - “InvokeAction” called by the controller.

Top 10 Interview Questions & Answers of ASP.Net C#

What is ASP.NET?


ASP.NET was developed in that response to the problems that developers have with classic ASP. since it is in such widely used, Microsoft ensures that SP script executes without modification on a machine with the Dot Net Framework( The ASP engine, ASP.DLL, Is not modified when installing the Dot Net Framework). Thus, IIS can house both ASP and ASP.NET scripts on the same machine.

Advantages of ASP.NET:

Separation of God from HTML: To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.
Support for compiled languages: developer can use VB.NET and access features such a strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET Pages are precompiled to bytecode and Just In Time (JIT) compiled when first requested. The subsequent request is directed to the fully compiled code which is cached under the source changes.
Use services provided by the .Net Framework: The .NET Framework provides a class library that can be used by your application. Some up the classes help you with input/ output, assist operating system services, data access or even debugging.
Graphical Development Environment: Visual Studio .NET provides a very rich development environment for web developers. You can drag and drop controls and their properties the way you do in Visual Basic 6 and you have full IntelliSense support, not only for your code but also for HTML and XML.
State management: To refer to the problems mentioned before, ASP.NET provides a solution for session and application state management. The state information can, for example, be kept in memory of stored in the database. It can be shared across web forms, and state information can be recovered even if the server fails or the connection breaks down.

ASP.NET overview

Here are some points that give a quick overview of ASP.NET:
ASP.NET provides services to allow the creation, deploy, and execute application and Web Services.
Like ASP, ASP.NET is a server-side technology.
Web applications are built using web forms. ASP.NET comes with built-in web form controls, which are responsible for generating the user interface. The mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.
Web forms are designed to make building web-based applications as easy as building Visual Basic applications.

2. What are the different validators in ASP.NET?


ASP.NET validation controls define an important role in validating the user input data. Whenever you will give the input, it must always be validated before sending it across to various layers of an application.If we get the user input with validation, then chances are that we are sending the wrong data. So, meditation is a good idea to do whenever we are taking input from the user.

There are the following two types of validation in ASP.NET:
Client-Side Validation
Server-Side Validation
Client-Side Validation: When validation is done on the client Browser, then it is known as Client-Side Validation. We use JavaScript to do the Client-Side Validation.

Server-Side Validation: When Validation occurs on the server, then it is known as Server-Side Validation. It is a secure form of validation. The main advantage of Server Side Validation is if the user somehow bypasses the client-side validation we can still catch the problem on the server-side.

The following are the validation controls in ASP.NET:
RequiredFieldValidator control
CompareValidator control
RangeValidator control
RegularExpressionValidator control
CustomFieldValidator control
ValidationSummary

3. What is View State?


View State is the method To preserve the value of the page and control between round trips. It is a Page-Level state management technique. View State is turned on by default and normally serializes the data in every control on the page regardless of whether it is actually used during a post-back.

A web application is stateless. It means that a new instance of a page is created every time when we make a request to the server to get the page and after the round trip our page has been lost immediately.

Features of View State:
There are a few features of view state:
Returns the value of the Control after postback without using a session.
Stores the value of Pages and Control properties defined in the page.

Create a custom view state provider that lets you store view state information in a SQL Server Database or in another data store.

Advantages of ViewState:


Easy to implement.
No server resources are required: The view state is contained in a structure within the page load.
And has a security feature: It can be encoded uncompressed or Unicode implementation.

Rewrite whole Web Site System and Sub System with data migration to new system.

Can you please share me your skype id or whats up number for better communications  my skype id is - jitendra.tech  whats up - +919617741414...