online Asp.Net C# interview Questions for freshers
Q. What is View State in asp.net?
A. View State is the method to preserve the Value of the Page and Controls 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. That 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.
Q. What are the main features of view state?
A. Features of View State
Stores the value of Pages and Control Properties defined in the page.
Retains the value of the Control after post-back without using a session.
Creates a custom View State Provider that lets you store View State Information in a SQL Server Database or in another data store.
Q. Explain the advantages of view state?
A. Advantages of View State
Easy to Implement.
No server resources are required: The View State is contained in a structure within the page load.
Enhanced security features: It can be encoded and compressed or Unicode implementation.
Q. What is caching in ASP.NET?
A. Caching is one of the most interesting concept and operation in ASP.NET. If you can handle it, you can run any web application by applying the caching concept depending on the requirements. Caching is for providing solutions or the results to the users depending on their request, admin needs to recreate the pages often depending on user requests…STOP!!! "A cache simply stores the output generated by a page in the memory and this saved output (cache) will serve us (users) in the future.".
Page caching
Fragment caching
Data Caching
Q. What is MVC in asp.net?
A. Model-View-Controller (MVC) is a pattern to separate an application into the following three main components:
Model
View
Controller
The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating web applications.
The ASP.NET MVC Framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentications.
The MVC framework is defined in the System.Web.Mvc assembly. It provides full control over HTML, JavaScript and CSS. It's the better as well as a recommended approach for large-scale applications where various teams are working together.
Q. What are the approaches where we can populate a Dataset?
A. We can populate the Dataset using different the approaches mentioned below:
Using DataAdapter objects and ‘fill’ method.
Programmatically creating Datatable, Datarow, and Data column objects.
Data from Xml Documents.
Merging with another Dataset.