ASP.NET Interview Questions & Answers

1) Distinguish OLEDB Provider from SqlClient.

SqlClient is mainly used to gain optimal results by the way of optimizing the combination of SQL server and Dot Net. It is relatively faster than the Oracle provider and it is quick to access the database through the OLEDB layer. Since it has access to the native library, a facility thereby the performance becomes considerably better, it is quick to respond and written efficiently with a support from a team of SQL Server developers.

2) Explain in detail the concept of Remoting.

Even if they are found on the same computer, the communication process differs completely from the operating system processes. So, the architecture of Dot Net remoting simplifies the communication between the objects, regardless of the application domain in which they may reside. Even though they may be in a different computer system, and the context may be different, but the communication is not hindered in any way at all with Remoting.

3) Distinguish between System.StringBuilder and System.String.

The structure of the string of System.StringBuilder can be altered and subject to mutations. With this attribute, we can perform various operations as it is open to mutable features. But System.String is staunchly immutable by its very design and the operative mode is strictly one-sided.

4) What are an interface class and a delegate?

An interface class is consist of the public abstract methods that should be implemented within the inherited classes.

In a delegate, which is known as the function pointers in C++, the reference to a method is bound within the system.

5) In the process of page loading, what are the roles of aspnet_isapi.dll and inetinfo.exe?

When a file with the .aspx extension request is received, aspnet_isapi.dll, the ISAPI filter, passes off the request to aspnet_wp.exe, which is the actual worker process.

6) What are the methods to launch a page load?

  • To initiate the page, Init() is used.
  • To load the page into the server memory, Load() is used.
  • To display the page in HTML, PreRender() is used.
  • Once the page loading is done, Unload() is applied.

7) When is ViewState available in the meantime of page processing cycle?

The ViewState is available before the OnLoad() command or the  Page_Load(), and after the Init() function.

8) Explain the bubbled event?

It is quite difficult to write an event processing routine for every object, objects like button, cell, and row if we have a complex control like DataGrid. So the main DataGrid event handler takes care of its constituents when the controls bubble up their event handlers.

9) Is the server or the client code in a Code-Behind class?

Since the code-behind is executed on the server, server-side code is found in the code-behind class.  But the code-behind renders the client-side code like JavaScript during the execution of the code-behind. But code-behind is a server-side code because it is executable on the server.

10) Where should the user input data validation occur?

It is highly recommended that the processes of the input data validation of the user must take place only on the server-side. But the client-side validation provides a richer and the more responsive experience and it should be performed where the need be.

11) How Server. Transfer differs from Response. Redirect?  

Server.The transfer does not make the trip to the browser of the client, but the page processing is directed from one page to another very easily. So the response time is considerably accelerated. The URL history list of the client or the current URL does not update by the clients. To redirect the browser of the user to another page, Response. Redirect can be used. It goes back to the client and here the browser, in turn, rerouted to a new page.

12) What are the differences between ADO Recordset and an ADO.NET Dataset?

  • A dataset represents the whole of the relational database in the memory, which is inundated with views, relations, and tables.
  • Even without any continuing link to the original data source, a DataSet can work efficiently.
  • DataSet does not being loaded on-demand but loaded a bulk.
  • The cursor types are absent from a DataSet.
  • Many edits can be stored in a DataSet, and in a  single operation can be written to the original data.
  • For different data sources, ADO.NET comes in different versions, although the DataSet is universal.

13) What is the purpose of Global.asax?

In order to implement the session level events and application, Global.asax, that also includes the Global.asax.cs file can be used.

14) When is the concept of inheritance used?

The concept of inheritance is used when do we want to acquire the functionality of another class. For instance, if there is a base class named Employee, from that base class a Manager class could be derived. So, in that way, new sub-classes are inherited and populated.

15) What is the difference between the code-behind and inline?

If a code is written in a discrete file and cited by the .aspx page, that is Code-behind.

But as for the inline code, it is written in a page along with the HTML.

Are you Interested In Joining ?

Attend a Free Demo Session with a sip of Coffee

16) What is diffgram and how it is used?


For the purpose of rendering the contents in a DataSet object to XML, DiffGram,  one of the two XML formats, is used. It is recommended to read the database data to an XML file that is to be sent to a Web Service.

17) What is MSIL and explain its significance?

Microsoft Intermediate Language (MSIL) is notable since all the Dot Net compatible languages can be converted to this language. And also, the Dot Net  Framework can do the task of compiling the JIT on the installed computer.

18) Can the data in the Repeater control be edited?

Since it is just equipped with the ability to read the information from the data source, the data in the repeated control cannot be edited.

19) What is  ItemTemplate?

In a repeater control, the data can only be displayed with the template of  ItemTemplate.

20) What is AlternatingItemTemplate?

This template that is used in a repeater control to provide it with an alternating color scheme is AlternatingItemTemplate.

21) What are  DataSource and DataBind?

In the event of bind together the data from a data source, along with the repeater control, the DataSource property should be set and the DataBind method should be called.

22) What is the DataTextField property?

To display data in the combo box, even before setting the DataSource, the  DataTextField property is set on a Combo Box along with a column name.

23) How is a page executed in ASP.NET?

The server receives the page and decides the type of the engine that needs to be assigned for the request. There are many dlls options from which we can opt for the type of the page that is to be handled. And the request is handled by the engine and the result is, in turn, returned to the server and the result is returned back to the client browser. A single .aspx file, among other files related to the page, is contained in an ASP.Net page. As the .aspx file contains the visual content of the page, it is called the content file.

24)Distinguish between the Array and the HashTable?

An ArrayList is designed so as to contract and expand dynamically when the elements are added or removed. And in every other way, it is alike to an array. To look-up the objects categorized by a key value, we can use a HashTable. Although it does contract and expands, just like an ArrayList does, it never does impose an order. In an ArrayList, elements are indexed with a numeric index, but in a HashTable, a key is used to index elements, a key that is usually a string.

25) What are the session state management types available in ASP.NET?

Both In-Process and out-Process state management is available in ASP.NET. The session in the memory is stored on the web server. To support the user to connect again to the exact web server, there should be a “sticky-server”, without which the load-balancing cannot be done. To store the data in an external data source, Out-of-Process Session state management can be availed. This external data source may contain either a State Server service or a SQL Server. All the objects stored in the session should be serializable for the out-of-process state management.

26) What is garbage collection?

Even if an object can no longer be accessed, with the mechanism of Garbage collection, the computer can notice it. The memory utilized by that particular object is also released by the Garbage collectors. The memory is compacted and compressed by the Garbage collectors, so we can reduce the working set of the program.

27) Explain the Dot Net data types?

There are exhaustive amounts of various types in Dot Net Framework by which we can have the values and store and manipulate them between the entities of the application.

And in the Dot Net Framework, objects that belong to a particular type cannot be exchanged with other type’s objects. We can convert the data types with the processes of implicit and explicit conversions methods. The major Dot Net data types are:

  • float
  • int
  • string
  • char
  • decimal
  • Double

28) Define and explain exceptions

Exceptions represent a breach of an implicit assumption made within code. For example, if your code tries to access a file that is assumed to exist, but the fiction.

Exceptions are not necessarily errors. Whether or not an exception represents an error is determined by the application in which the exception occurred. An exception that is thrown when a file is not found may be considered an error in one scenario, but may not represent an error.

List of some general ADO.Net Terms.

  • Data Source: It can be a database, text file, excel spreadsheet or an XML file.
  • Data Provider: A set of libraries that are used to communicate with the data source. Eg: SQL data provider for SQL, Oracle data provider for Oracle, OLE DB data provider for access, excel or mysql.
  • SQL Connection: It establishes connection.
  • SQL Command: It allows to manipulate the database by executing a stored procedure or SQL statements.
  • SQL DataReader: It provides a forward-only, read-only, connected recordset.
  • DataSet: dataset is an in-memory representation of data, which is disconnected. It can contain multiple data table from the different database.
  • SQL DataAdapter: It populates a dataset from the data source. It contains a reference to the connection object and opens and closes the connection automatically when reading from or writing to the database.
  • DataView: It provides a means to filter and sort data within a data table.
  • Disconnected Data Source: Ado.net makes the connection to the database server only when it needs to do a transaction and disconnects once the transaction is over (similar to an HTTP connection over the internet). The network traffic is reduced a lot by this.
  • Strongly Typed Dataset Object: Strongly typed Dataset object allows you to create early-bound data retrieval expression. It is faster than late-bound data retrieval expression.

29) What does an assembly contain?

  • Assembly Manifest – Metadata that describes the assembly and its contents
  • Source Code – Compiled into the MSIL.
  • Type Metadata – Defines all types, their properties and methods, and most importantly, public types exported from this assembly
  • Resources – Icons, images, text strings and other resources

30) Explain the process of signing an assembly?

To corroborate the veracity of an assembly, Dot Net uses the digital signatures. With the assistance of public key cryptographies like the SHA-1 hash algorithm and the RSA public key algorithm. A developer can use both the public and the private keys for the process of cryptography.

To generate an assembly with strong characters, it is suggested to a developer that it should be signed with the private key. And when the system is loaded, it is verified by the proportional public key.

Are you Interested In Joining ?

Attend a Free Demo Session with a sip of Coffee

31) What is the use of ErrorProvider Control?


The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.

32) What is Asynchronous Database Commands in ASP.Net?

When we execute any database command. The thread that executing the command waits the command get fully executing before executing any additional code and thread is blocked for another process. But Asynchronous Database Commands solve this problem when database command is executing the current thread can continue on another process. The thread can execute a number of database commands. There are two benefits of using Asynchronous Database Commands:
Executing Multiple Database Commands simultaneously improve performance. Because ASP.Net framework uses a limited pool service for a request.

When any request for a page comes it assigns a thread to handle the request. If the framework is out of the thread then the job is in guess we get error 503. But if we are using asynchronous database command then current thread is released back to the current thread pool.

33) Explain the concept of connection pooling in ASP.Net?

Rather than generating a fresh connection with every request, the performance of the Web applications can be increased with the concept of connection pooling. Database connections that are open can be established along with it. The task of the pool manager is to check the pool and see if it contains any unused and redundant connections when new connection requests come in. The new connections are generated and added to the pool if the existing connections are occupied and the level of pool size is not achieved.

Now if the pool is reached its level and no more can contain new connections, the upcoming requests of the connections are in a queue to a new connection in the pool could be made.

34) What are the differences between the SessionState and the ViewState?

The data of a user can linger and persist with SessionState command. The data last here as long as the user works on the browser or the time is completed.

The values of controls of any given page linger in the browser when the postback tasks are completed. When a user requests another page previous page data no longer available.

35) What are possible implementations of distributed applications in ASP.Net?

ASP.Net Remoting and ASP.Net Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.

36) In ASP.Net, how the problem of DLL Hell is solved?

The application specifies the version of the assembly along with the library it requires to run with the assistance of the feature called assembly versioning. So this resolves DLL Hell.

37) What is the XML Schemas?

An XML schema is a document that defines the structure of XML data. Much like a database schema, an XML schema can be used to validate the contents and structure of an XML file.

An XML schema is defined by using the XML Schema Definition Language(XSD). XSD is similar in structure to HTML, but whereas HTML defines the layout of a document, XSD defines the structure and contents of the data

.

38) How to merge data into two DataSet objects?

Use the DataSet.Merge() method with the appropriate MissingSchemaAction enumeration values. The Merge() method of the DataSet object can merge a DataRow array, a DataTable, or a DataSet into an existing DataSet. If the Dataset has a primary key defined, the incoming data is matched to rows with the same key values. Where matches found, the existing row is updated with the new values. Otherwise, rows are appended to the existing table.

39) In ASP.NET 2.0, What are the data controls?

in order to support the repeated-value binding, the second version of ASP.NET is consist of some proficient data controls. And these rich data controls are developed just for the process of data binding. They also have the ability to display several properties or fields from each data item, often in a table-based layout or according to a template we have defined; they support higher-level features such as editing, and they provide several events that allow you to plug into the controls inner workings at various points.

40) What is smart navigation in ASP.NET Pages?

  • Eliminating the flash caused by navigation.
  • Persisting the scroll position when moving from page to page.
  • Persisting element focus between navigations.
  • Retaining only the last page state in the history of the browser.
  • Smart navigation is best used with ASP.NET pages that require frequent postbacks but with visual content that does not change dramatically on return. Consider this carefully when deciding whether to set this property to true.

41) What is Cross Page Posting?

By default, ASP.Net submits a form to the same page. But the form is submitted to a different page when it comes to the cross-page posting. This is done by setting the PostBackUrl property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the FindControl method of the PreviousPage property to reference the data of the control on the first page.

42) At runtime, What is the effect of changing the web.config file?

ASP.Net invalidates the existing cache and assembles a new cache. Then ASP.Net automatically restarts the application to apply the changes.

43) Why is AutoEventWireup used in the Page directive of the ASP.NET?

The AutoEventWireUp is a boolean attribute that allows automatic wire-up of page events when this attribute is set to true on the page. It is set to True by default for a C# web form whereas it is set as False for VB.Net forms. The page events are individually bound to handlers and the attributes are set to false for the pages developed with Visual Studio Dot Net.

44) In ASP.NET, what type of caching is used?

  • Output Caching: Output cache stores a copy of the final rendered HTML page sent to the browser. When the next client requests for this page, the page is not actually run instead the cached copy of the HTML is sent thus saving time.
  • Data Caching: Data cache stores pieces of information like DataTable or DataSet retrieved from a database. Data caching is similar to application state, but it is more server friendly. Because cache items could be removed from the server memory if it grows large and affects performance. Items can also be set to expire automatically.

The following types of caching are built on these two models.

  • Fragment caching: instead of caching the entire HTML page, you can cache a portion of it.
  • Data source caching: this is built into the data source controls like—the SqlDataSource, ObjectDataSource, and XmlDataSource. You need to configure the appropriate properties and the data source control manages the caching storage and retrieval.

45) Explain the role of user controls in ASP.Net?

User controls use the similar techniques used by the web server controls and HTML and they can be reused. And across the ASP.NET Web applications, we can reuse common user interfaces and partition them easily. A Web Forms page uses the Web Forms programming model, which is the exact model used by the user controls of ASP.NET.

46) Explain the concepts of custom controls?

The tasks of exposing the object model, rendering markup texts like XML and HTML are executed by the custom controls, tasks that can be done by a usual user control or Web Form.

47) Distinguish the SQL Server Authentication and the Windows Authentication in ASP.Net?

Windows Authentication is used when your user is tied up with the Windows Domain and you can validate the requested user against your domain controller or Active Directory.

When you configure ASP.NET for Windows authentication, it can be coupled with IIS authentication where IIS authenticates your application users by using Basic authentication, Integrated Windows authentication, Digest authentication, or Client Certificate authentication. Both Integrated Windows authentication and Client Certificate authentication provide strong authentication, but Integrated Windows authentication is recommended unless you have a PKI infrastructure and your clients have certificates.

SQL Server Authentication is more storing the user information in the database and when the user returns you pick there username and password to validate against the stored information in SQL Server database. This approach is taken in the internet application where they can store some information during the sign in and validate when they return back.

48) What are the Validation Controls provided by ASP.NET?

There is six type of Validation Controls available in Asp.Net. These are :

  • RequiredFieldValidator
  • CompareValidator
  • RangeValidator
  • RegularExpressionValidator
  • CustomValidator
  • ValidationSummary

49) Explain state management and its uses?

State management is nothing but maintaining the user information on the client side or server side. Generally, there are two different types of state management:

  • Server-side state management – Session, Application, Caching, Profiles.
  • Client-side state management – Query string, Hidden field, Cookies, Viewstates.

50) List out the components of CLR?

  • ClassLoader.
  • MSIL to native Compiler.
  • Code Manager.
  • Garbage Collector.
  • Security Engine.
  • Type Checker.
  • Thread Support.
  • Exception Manager.
  • Debug Engine.
  • Com Marshaler.

51) What are the uses of web.config file in ASP.Net?

The ASP.Net Web.config file is used to define the configuration settings for an ASP.Net application. It is an XML file. It contains configuration sections for Web Applications which we can configure manually either by using Web Site Administration Tool or by inline in the Web.config. We can also store static application settings or connection strings in this XML file. Root web.config file is in the location

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\.

This is the common configuration file and we can also include configuration file to our application folders or Subfolders so that we can override the settings from Parent to Child.

Generally, we store database connections, Session States, Error Handling, Security configurations in ASP.Net web. Config file.

52) What is validation summary server control? where is it used?

In the event of summarizing the error messages in a single location, the errors that arise from all the validation controls with the assistance of the ValidationSummary control. The summary can be displayed as a list, a bulleted list, or a single paragraph, based on the value of the DisplayMode property.

The ErrorMessage property, which is the part of the validation control, specifies the ValidationSummary control for each validation control entity. No error message is shown in the ValidationSummary control, in case the ErrorMessage property of the validation control is not set for that particular validation control. You can also specify a custom title in the heading section of the ValidationSummary control by setting the HeaderText property. You can control whether the ValidationSummary control is displayed or hidden by setting the ShowSummary property. Just by setting the ShowMessageBox property to display true, the summary can also be displayed in a message box.

53) How can we use COM components in Dot Net?

.Net components communicate with COM components using RCW called Runtime Callable Wrapper. Following are the ways in which you can use RCW –

  • Adding reference using Visual Studio. The wrapper class is generated and placed in the bin directory.
  • Using the type library importer tool – Tlbimp.exe.
  • Using Interop services. System.Runtime.Interopservices namespace contains TypeLib Converter which provides methods to convert COM classes and interface into assembly metadata.
  • Make your own custom wrappers.

Are you Interested In Joining ?

Attend a Free Demo Session with a sip of Coffee

Hope you gained enough confidence for your Interview If you wish to know the real time examples and guidance on your projects, enrol with us for the best Dot Net Training in Chennai.

March 14, 2023
© 2023 Hope Tutors. All rights reserved.

Site Optimized by GigCodes.com

Request CALL BACK