ASP.NET Interview questions and answers



Basic ASP.NET Interview questions and answers

ASP.NET Interview
Asp.net Interview
The ASP.NET Interview questions and answers mentioned over here are usually asked freshers/beginners or developers having less than 1 year of relevant asp.net experience. A list of top frequently asked ASP.NET Interview questions and answers are given below.

1] What is ASP.NET? Why asp.net?

Answer-Asp.net is a .NET web Technology or server-side technology.
To develop a web application by using .net we have to use a .net web technology called ASP.net and
a .net language called C# .Net.

2] What do you mean by Server-side technology?

Answer- 1. The code which is executing within the webserver is called server-side code.
2.server-side code we can be implemented by using server-side technologies.EX.ASP,ASP.NET, JSP, PHP
3. Using serverside technology we can develop server web pages.

3]What do you mean by client-side technology?

Answer-1.The code which is executing within the WEB browser is called Client-side code.
2.Client-side code we can implement by using client-side technologies.
3.EX.Java Script, HTML, CSS

4]What are programming techniques will be supporting by asp.net?

Answer- Asp.net will support 2 programming techniques. they are -
1.Inpagetechnique and
2.Code being technique

5]How can we pass values between ASP.NET pages?

Answer- Different techniques to move data from one webform to another are:
The query string, cookies, session state, Application state, Cross page postback
context.handler object

6]Explain validation controls in asp.net?

Answer- There are 6 validation controllers:-
1.Required field control 2. Compare validator 3.Range validator 4.regular expression validator 5. custom validator 6.validation summary

7]How to invoke server-side validation function and how to invoke client-side validation function?

Answer- Server-side validation functions can be invoked by using ASP.net and client-side validation
the function is invoked with the help of javascript and HTML.

8] what are the life cycle events of asp.net?

Answer-Application level, Control level, page level.

Asp.net Employee

9) What is a global.asax file?

Answer-The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to
application-level events raised by ASP.NET or by HttpModules.
The Global.asax file resides in the root directory of an ASP.NET-based application.
The Global.asax file is parsed and dynamically compiled by ASP.NET.
The Global.asax file itself is configured so that any direct URL request for it is automatically rejected;
external users cannot download or view the code written within it.
The Global.asax file does not need recompilation if no changes have been made to it.
There can be only one Global.asax file per application and it should be located in the application's root directory only.

10) What is the MVC pattern?

Answer- The Model-View-Controller (MVC) architectural pattern separates an application into three main groups of components:
Models, Views, and Controllers.
This pattern helps to achieve separation of concerns Using this pattern, user requests are routed to a controller who is responsible for working with the Model to perform user actions and/or retrieve results of queries. The Controller chooses the View to display to the user, and provides it with any Model data it requires.
This delineation of responsibilities helps you scale the application in terms of complexity because it's easier to code, debug, and test something (model, view, or controller) that has a single job.
It's more difficult to update, test, and debug code that has dependencies spread across two or more of these three areas.
For example, user interface logic tends to change more frequently than business logic.
If presentation code and business logic are combined in a single object, an object containing business logic must be modified every time the user interface is changed.
This often introduces errors and requires the retesting of business logic after every minimal user interface change.

3)Introduction-ViewData, ViewBag, TempData, and Session.

Answer-Before we discuss the difference between ViewData, ViewBag, TempData, and Session.
Let's learn about the main use of transferring data from the Controller to View in MVC.
ViewData, ViewBag, TempData, and Session are weak types, which means if you misspell a variable name it throws an error in runtime, not compile time.

Transporting data from the controller to view

A controller is responsible for handling overall communication between model and view.
It will access data from the model and send it to View. They are:
*ViewData
*ViewBag
*TempData
*Session

*View Data
.It is a property of the ControllerBase (Abstract class) class
.It is a type of ViewDataDictionary
.It is a dictionary type collection with key and value pair

.Syntex

ViewData.Add("Employees", "Ankit Sahu");
OR
ViewData["Employees"] = "Ankit Sahu";

.It cannot return complex values directly on a callback
.It is available for the current request. Data in ViewData and is not available across the request
.It's present in MVC framework 1.0
.ViewData is faster in compression to ViewBag
.Its value becomes NULL if a redirection has occurred.

*ViewBag
.It is a property of the ControllerBase (Abstract class) class
.It is a dynamic type
.Dynamic type stores values in implicitly typed references. Hence they are resolved only in runtime.
.Syntex

ViewBag.
Employees=
"Ankit Sahu";
.It can return complex values directly on a callback.
.It is available for the current request. Data in ViewBag is not available across the request
.It's present in MVC framework 3.0
.ViewBag is slower in compression to ViewData
.Its value becomes NULL if a redirection has occurred.

*TempData
.It is a property of the ControllerBase (Abstract class) class
.It is a type of TempDataDictionary
.It is a dictionary type collection with key and value pair

.Syntex

TempData.Add("Employees", "Ankit Sahu");
OR
TempData["Employees"] = "Ankit Sahu";

.It cannot return complex values directly on a callback.
.It is available for the current request. Data in TempData is not available across the request.
.It is implicit and available only for all context
.It's present in MVC framework 1.0
.Call TempData.Keep() to keep all the values of TempData in a third request.

*Session
.It is a property of the Controller(Abstract class) class
.It is a type of HttpSessionStateBase
.It is a dictionary type collection with key and value pair

.Syntex

Session.Add("Employees", "Ankit Sahu");
OR
Session ["Employees"] = "Ankit Sahu";

.It cannot return complex values directly on a callback
.It is available for the current request. Data in Session data is available across the request
.It's present from MVC framework 1.0
.All session information is stored on the server-side.

This Common ASP.NET INTERVIEW QUESTIONS for all interviews.

In this article, we focus on both ASP.NET Interview questions. To limit the article’s scope, we assume that you have programmed in the C# programming language. A basic understanding of common object-oriented concepts and front-end technologies such as HTML, CSS, and JavaScript is also expected. 

If you found this article useful, share it.*

Umesh Mahajan | Facebook

Nature's Routes (naturesroutes.blogspot.com)

Watches (tiptopstores.blogspot.com)

No comments:

Post a Comment