get the app get the app       get the app       get the app

. NET Interview QUESTIONS

Exam Name. NET Interview QUESTIONS
Description. NET Interview QUESTIONS contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview.
Exam TypeMASTER EXAM
Authenticity2
creatorAnirudh(39126)

Back to Parent Category
Create QuestionPDF  
.
Question: What is the difference between VB.NET and C#?

Answer:Well this is the most debatable issue in .NET community and people treat there languages like religion. Its a subjective matter which language is best. Some like VB.NET’s natural style and some like professional and terse C# syntaxes. Both use the same framework and speed is also very much equivalents. But still let’s list down some major differences between them :- Advantages VB.NET :-
1. Has support for optional parameters which makes COM interoperability much easy.
2. With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace.
3. Has the WITH construct which is not in C#.
4. The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.
Advantages of C#
1. XML documentation is generated from source code but this is now been incorporated in Whidbey.
2. Operator overloading which is not in current VB.NET.
3. Use of this statement makes unmanaged resource disposal simple.
4. Access to Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies).This is the major difference that you can access unmanaged code in C# and not in VB.NET.


Question: What is CODE Access security?

Answer:CAS is part of .NET security model that determines whether or not a piece of code is allowed to run and what resources it can use while running. Example CAS will allow an application to read but not to write and delete a file or a resource from a folder..


Question: How to prevent my .NET DLL to be decompiled?

Answer:By design .NET embeds rich Meta data inside the executable code using MSIL. Any one can easily decompile your DLL back using tools like ILDASM (owned by Microsoft) or Reflector for .NET which is a third party. Secondly there are many third party tools which make this decompiling process a click away. So any one can easily look in to your assemblies and reverse engineer them back in to actual source code and understand some real good logic which can make it easy to crack your application. The process by which you can stop this reverse engineering is using "obfuscation". It’s a technique which will foil the decompilers. There are many third parties (XenoCode, Demeanor for .NET) which provide .NET obfuscation solution. Microsoft includes one that is Dotfuscator Community Edition with Visual Studio.NET.


Question: Difference between ASP.NET WebForms and ASP.NET MVC?

Answer:ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it's own controller i.e. code-behind file that processes the request. On the other hand, ASP.NET MVC uses Front Controller approach. In this approach a common controller for all pages, processes the requests.


Question: What are major difference between classic ADO and ADO.NET ?

Answer:ADO

  • ADO have recordset
  • ADO objects communicate in binary mode.
  • ADO Supports mostly Connection oriented Models
  • Since ADO derives information about data implicitly at run time based on metadata , it is an expensive process.
  • Only Client Side Cursors are allowed in ADO.

    ADO.Net

  • ADO.Net have Data Adapter and Data set
  • ADO.NET uses XML for passing the data.
  • ADO.Net works in Disconnected manner
  • By leveraging known meta data at design time, ADO.Net provide better runtime performance and more consistent runtime behaviour
  • ADO.Net Support both client side and server side cursors



  • Question: What are the two fundamental objects in ADO.NET ?

    Answer:Fundamental Objects of ADO.Net are DataReader and DataSet . DataSet Object can have a set of DataTables, relationships between these tables. DataSet can be used in disconnected connection with DB. DataReader is used to read the read only data from a database.



    Question: What is difference between dataset and datareader ?

    Answer:DataReader is used to fetch data from a database in a much faster way. Since the rows are fetched one at a time, load on the network will be low. Since DataReader is read only, transactions are not allowed . Since it is forward only, random data fetch is not supported.

    DataSet is an in memory representation of a tables in a database. Dataset takes lot of application memory compared to DataReader. Its slower compared to DataReader. But user can do transactions using DataSet. It also support querying.



    Question: What is the use of connection object ?

    Answer:Connection Objects is used to establish a connection between an application and databases like Oracle, MySQl, SQL Server etc. Once connection is established, SQL Commands like insert, update, delete and select can be executed. Scope of a connection object can be local or global. If local connection object is used, it should be closed after SQL commands are executed.


    Question: Please briefly explain ASP.NET Page life Cycle?

    Answer:ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it's own controller i.e. code-behind file that processes the request. On the other hand, ASP.NET MVC uses Front Controller approach. In this approach a common controller for all pages, processes the requests.

    Please follow for detailed information on WebForms Vs MVC.

    Please briefly explain ASP.NET Page life Cycle?

    ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.

    Initialization: Controls raise their Init event in this stage.Objects and variables are initializes for complete lifecyle of request.

    LoadViewState: is a post back stage and loads the view state for the controls that enabled its view state property.

    LoadPostBackData: is also a post back stage and loads the data posted for the controls and update them.

    Load: In this stage page as well as all the controls raise their Load event. Till this stage all the controls are initialized and loaded. In most of the cases, we are coding this event handler.

    RaisePostBackEvent: is again a postback stage. For example, it's raise against a button click event. We can easily put our code here to perform certain actions.

    SaveViewState: Finally, controls state is saved in this stage before Rendering HTML.

    Render: This is the stage where HTML is generated for the page.

    Dispose: Lastly, all objects associated with the request are cleaned up.


    Question: What is the difference between custom controls and user controls?

    Answer:Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.

    But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly couple with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.


    Question: What is the concept of view state in ASP.NET?

    Answer:As in earlier question, we understood the concept of postback. So, in order to maintain the state between postbacks, ASP.NET provides a mechanism called view state. Hidden form fields are used to store the state of objects on client side and returned back to server in subsequent request (as postback occurs).


    Question: Difference between Response.Redirect and Server.Transfer?

    Answer:In case of Response.Redirect, a new request is generated from client-side for redirected page. It's a kind of additional round trip. As new request is generated from client, so the new URL is visible to user in browser after redirection.

    While in case of Server.Transfer, a request is transferred from one page to another without making a round trip from client. For the end user, URL remains the same in browser even after transferring to another page.


    Question: Please briefly explain the usage of Global.asax?

    Answer:Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.

    There is a good list of events that are fired but following are few of the important events in Global.asax:

    Application_Init occurs in case of application initialization for the very first time.
    Application_Start fires on application start.
    Session_Start fires when a new user session starts
    Application_Error occurs in case of an unhandled exception generated from application.
    Session_End fires when user session ends.
    Application_End fires when application ends or time out.


    Question: What is the use of Command objects?

    Answer:They are used to connect a Connection object to a DataReader or DataSet. Following are the methods provided by a Command object:

  • ExecuteNonQuery
    Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.

  • ExecuteReader
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.

  • ExecuteScalar
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only a single value (effectively the first column of the first row of the resulting row set, any other returned columns and rows are discarded). It is fast and efficient when only a "singleton" value is required.



  • Question: What are the different types of Validation controls in ASP.NET?

    Answer:In order to validate user input, ASP.NET provides validation server controls. All validation controls inherits from BaseValidator class which contains the common validation properties and methods like ControlToValidate, Enabled, IsValid, EnableClientScript, ValidationGroup,Validate() etc.

    ASP.NET provides a range of validation controls:

    RequiredFieldValidator validates compulsory/required input.
    RangeValidator validates the range. Validates that input falls between the given range values.
    CompareValidator validates or compares the input of a control with another control value or with a fixed value.
    RegularExpressionValidator validates input value against a defined regular expression pattern.
    CustomValidator allows to customize the validation logic with respect to our application logic.
    ValidationSummary displays all errors on page collectively.


    Question: What is the use of a data adapter?

    Answer:These objects connect one or more Command objects to a DataSet object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.

  • An OleDbDataAdapter object is used with an OLE-DB provider
  • A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.



  • Question: What are the types of Authentication in ASP.NET?

    Answer:There are three types of authentication available in ASP.NET:

  • Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
  • Forms Authentication: authenticate against a customized list of users or users in a database.
  • Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.



  • Question: What is ADO.NET ?

    Answer:ADO.Net is one of the major component of .Net Framework, which is designed to connect to databases like Oracle, MySQL, SQL Server, MS Access etc. and work with data stored in them.


    Question: What are Session state modes in ASP.NET?

    Answer:ASP.NET supports different session state storage options:

  • In-Process is the default approach. It stores session state locally on same web server memory where the application is running.

  • StateServer mode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.

  • SQLServer mode stores session state in SQL Server database. It has the same advantages as that of StateServer.

  • Custom modes allows to define our custom storage provider.

  • Off mode disables session storage.



  • Question: What is a DataSet object?

    Answer:The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.