dot net Interview Questions

.NET Interview Questions

1.What is the difference between early binding and late binding?
 
   
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

2. What is reflection?
     
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.
The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.

3. What is ASP.NET?

ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.ASP.NET provides increased performance by running compiled code.

4.What is the difference between Classic ASP and ASP.Net?
     
ASP is Interpreted language based on scripting languages like Jscript or VBScript.ASP has Mixed HTML and coding logic.Limited development and debugging tools available.
Limited OOPS support.Limited session and application state management.ASP.Net is supported by compiler and has compiled language support.Separate code and design logic possible.
Variety of compilers and tools available including the Visual studio.Net.Completely Object Oriented.Complete session and application state management.Full XML Support for easy data exchange.

5.What is Difference between Namespace and Assembly?

Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

6. What is the difference between Server.Transfer and response.Redirect?
     
The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page.
While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.

7. What is a PostBack?
     
The process in which a Web page sends data back to the same page on the server.

8.What is the difference between static or dynamic assemblies?
     
Assemblies can be static or dynamic.Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files.
Dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.

9.What are the difference between Structure and Class?
     
Structures are value type and Classes are reference type Structures can not have constructor or destructors.Classes can have both constructor and destructors.
Structures do not support Inheritance, while Classes support Inheritance.

10.What is the differences between dataset.clone and dataset.copy?
     
Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn’t copy the data.
Dataset.copy, copies both the dataset structure and the data.

11.What is the difference between Custom Control and User Control?
     
Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.

12.What is the difference between ASP Session State and ASP.Net Session State?

ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.

13. What namespace does the Web page belong in the .NET Framework class hierarchy?
     
System.Web.UI.Page

14.What is a bubbled event?
     
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.

15.What is the differences between Server-side and Client-side code?
     
Server-side code executes on the server.Client-side code executes in the client’s browser.

16.What is ViewState?
     
ViewState is a .Net mechanism to store the posted data among post backs. ViewState allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.

17.What is Authentication and Authorization?
     
Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

18. What are the types of Authentication?
     
There are 3 types of Authentication. Windows, Forms and Passport Authentication.
Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users.
Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site.
Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across multiple Web applications. To use Passport authentication in your Web application, you must install the Passport SDK

19.What is datagrid?
     
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.

20.How many languages .NET is supporting now?
     
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.

21.What is smart navigation?
     
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

22.How do you validate the controls in an ASP .NET page?
     
Using special validation controls that are meant for this. We have Range Validator, Email Validator

23. How do you hide the columns?
     
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s “Visible” property.

24. What are different types of directives in .NET?
     
@Page
@Control
@Import
@Implements
@Register
@Assembly
@OutputCache
@Reference

25.What data type does the RangeValidator control support?
     
i.Integer
ii.String.
iii.Date.

26.What is cookies?
 
Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then re-use it on each page if needed.

27. What is the difference between Server-side scripting and Client-side scripting?
     
Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc.
Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript.

28. How do you create a permanent cookie?
     
Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.

29. Which method do you use to redirect the user to another page without performing a round trip to the client?
     
Server.Transfer
Server.Execute.

30.Which method do you use to redirect the user to another page without performing a round trip to the client?
     
Server.transfer

31.What tag do you use to add a hyperlink column to the DataGrid?
     
< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

32.How do you turn off cookies for one page in your site?
     
Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends.

33.Which two properties are on every validation control?
     
We have two common properties for every validation controls:
1.Control to Validate
2.Error Message

34.What is boxing and unboxing?

Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion.
Conversion of reference type variable back to value type is called as UnBoxing.

35. What is garbage collection?
     
Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy.

36.What is the use of @ Register directives?
     
@Register directive informs the compiler of any custom server control added to the page.

37. What is the difference between ASP Session State and ASP.Net Session State?
     
ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm

38. What is the difference between ASP Session and ASP.NET Session?
     
Asp.net session supports cookie less session & it can span across multiple servers.

39.Define RequiredFieldValidator?
     
It checks whether the control have any value. It's used when you want the control should not be empty.

40.What are the different types of Session state management options available with ASP.NET?
     
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

41. What is serialization?
     
Serialization is the process of converting an object into a stream of bytes.
Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects.

42. What is the differnce between Managed code and unmanaged code?
     
Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtimeto provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.
Un-Managed Code:Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).

43. What is difference between constants, readonly and, static?
     
Constants: The value can’t be changed.
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

44.In which event are the controls fully loaded?
     
Page_load event guarantees that all controls are fully loaded. Controls are also accessed.In Page_Init events but you will see that viewstate is not fully loaded during this event.

45.What are the difference between const and readonly?
     
A const can not be static, while readonly can be static.
A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.
A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.

46.What is the difference between early binding and late binding?
     
i.Calling a non-virtual method, decided at a compile time is known as early binding.
ii.Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

47.What is the difference between ASP Session and ASP.NET Session?
     
Asp.net session supports cookie less session & it can span across multiple servers.

48.What is Common Language Runtime?
     
CLR also known as Common Language Run time provides a environment in which program are executed, it activate object, perform security check on them, lay them out in the memory, execute them and garbage collect them.

49.What is Intermediate Language?
     
MSIL are also known as Microsoft Intermediate Language is the CPU-independent instruction set into which .Net framework programs are compiled. It contains instructions for loading, storing initializing, and calling methods on objects.

50.What is an assembly?
     
Assemblies are the building blocks of the .NET framework. They are the logical grouping of the functionality in a physical file.

51.What are different types of Assemblies?
     
i.Single file and multi file assembly.
ii.Assemblies can be static or dynamic.
iii.Private assemblies and shared assemblies.

52.What is CTS?
     
The Common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages.

53.Can we disable ViewState, If, yes how?
     
ViewState can be disabled by using "EnableViewState" property set to false.

54.Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
     
All the global declarations or the variables used commonly across the application can be deployed under Application_Start. All the user specific tasks or declarations can be dealt in the Session_Start subroutine.

55.What is Remoting?
     
Remoting is a means by which one operating system process, or program, can communicate with another process. The two processes can exist on the same computer or on two computers connected by a LAN or the Internet.

56. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
     
DataAdapter’s fill () method is used to fill load the data in dataset.

57.What is a Literal Control?

The Literal control is used to display text on a page. The text is programmable. This control does not let you apply styles to its content.

58. Which namespaces are used for data access?
     
System.Data
System.Data.OleDB
System.Data.SQLClient

59.How is method overriding different from overloading?
     
When Overriding, you change the method behavior for a derived classOverloading simply involves having a method with the same name within the class.

60. What is the difference between System.String and System.StringBuilder classes?
     
i.System.String is immutable.
ii.System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

61.What’s the use of “GLOBAL.ASAX” file?
     
It allows to executing ASP.NET application level events and setting application-level variables.

62.What is a SESSION and APPLICATION object?
     
Session object store information between HTTP requests for a particular user.Session variables are used to store user specific information where as in application variables we can’t store user specific information.
while application object are global across users.

63.What is the differences between Server-side and Clientside code?
     
Server side code is executed at the server side on IIS in ASP.NET framework.while client side code is executed on the browser.

64.What’s an interface?

It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

65.What is a formatter?
     
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.

66.What is a DataSet?
     
A DataSet is an in memory representation of data loaded from any data source.

67.What is a DataTable?
     
A DataTable is a class in .NET Framework and in simple words a DataTable object represents a table from a database.

68.What is a life span of a static variable?
     
A static variable’s life span is till the class is in memory

69.What is the difference between an abstract method & virtual method?
     
An Abstract method does not provide an implementation and forces overriding to the deriving class (unless the deriving class also an abstract class),
Virtual method has an implementation and leaves an option to override it in the deriving class. Thus Virtual method has an implementation & provides the derived class with the option of overriding it. Abstract method does not provide an implementation & forces the derived class to override the method.

70.How many namespaces are in .NET version 1.1?
     
124

71.What is AutoPostback?
     
AutoPostBack automatically posts the page back to the server when state of the control is changed.

72.What is Globalization?
     
Globalization is the process of creating multilingual application by defining culture specific features like currency, date and time format, calendar and other issues.

73.What is the main difference between Asp.net and Vb.net?
 
i.Asp.net is a web technology used for designing webforms and Vb.net is a programming language.
ii.ASP.NET is a powerful technology for writing dynamic web pages.
iii.ASP.NET is a way of creating dynamic web pages while making use of the innovations present in .NET.
iv.VB.NET is a language.But ASP.NET is the Environment where we can create websites or webpages.

74.Is string a value type or a reference type?
     
Srting is a Reference type.It can create a new instance at every time.

75.What base class do all Web Forms inherit from?
     
System.web.UI.Page class

76.What is the difference between an ADO.NET Dataset and an ADO Recordset?
     
i.A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
ii.A DataSet is designed to work without any continuing connection to the original data source.
iii.DataSets have no current record pointer You can use For Each loops to move through the data.
iv.Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
v.Data in a DataSet is bulk-loaded, rather than being loaded on demand.
viyou can store many edits in a DataSet, and write them to the original data source in a single operation.

77.What are the validation controls?
     
A set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

78.What is the difference between “Web.config” and “Machine.Config”?
     
“Web.config” files apply settings to each web application.
 While “Machine.config” file apply settings to all ASP.NET applications.

79.What is event bubbling?
     
Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.

80.What is the use of @ Register directives?
     
@Register directive informs the compiler of any custom server control added to the page.

81.What are the various security methods which IIS Provides apart from .NET?
     
The various security methods which IIS provides are :
i.Authentication Modes.
ii.IP Address and Domain Name Restriction.
iii.DNS Lookups DNS Lookups.
iv.Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
v.The Network ID and Subnet Mask.
vi.SSL.

82.What are Master Pages in ASP.NET?
     
ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.

83.What are the advantages of ASP.Net?
     
ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model.
ASP.NET offers built-in security features through windows authentication or other authentication methods.
Content and program logic are separated which reduces the inconveniences of program maintenance.
Built-in caching features.

84.What is event bubbling?
     
Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.

85.What is WSDL?
     
WSDL stands for Web Services Description Language is an XML-based language for describing Web services and how to access them.WSDL is used to describe Web services.

86.What is the use of @ Register directives?
     
@Register directive informs the compiler of any custom server control added to the page.

87.What is the difference between javascript and vbscript?

i.Javascript :

JavaScript is a client-side scripting language.
JavaScript is used to create interactive web applications supported by the Netscape browser.
JavaScript is simple to use, lightweight, and dynamic. Developers can easily embed code functionality for interactive applications inside a web page.
Javascript is case sensitive and it will be run on client side.

ii.VBScript:

VBScript is a server-side scripting language.
VBScript is not case sensitive and it will be run on server side.

88.What are the different types of Validation Controls?
     
There are six types of validation controls available :
1.RequiredFieldValidator
2.RangeValidator
3.RegularExpressionValidator
4.CompareValidator
5.CustomValidator
6.ValidationSummary

89.What is the Web User Control?
     
Combines existing Server and/or HTML controls by using VS.Net to create functional units that encapsulate some aspects of UI. Resides in Content Files, which must be included in project in which the controls are used.

90. What namespaces are necessary to create a localized application?
     
i.System.Globalization
ii.System.Resources

91.What is a web server?
     
A web server delivers requested web pages to users who enter the URL in a web browser. Every computer on the Internet that contains a web site must have a web server program.

92.What are Cascading style sheets?
     
Cascading style sheets (CSS) collect and organize all of the formatting information applied to HTML elements on a Web form. Because they keep this information in a single location, style sheets make it easy to adjust the appearance of Web applications.

93.What is the base class of .net?
     
System.object

94.What is difference between abstract classes and interfaces?
     
Abstract classes can have concrete methods while interfaces have no methods implemented.
Interfaces do not come in inheriting chain, while abstract classes come in inheritance.

95.What is GAC or Global Assembly Cache?
     
Global Assembly Cache (GAC) is a common place to share the .NET assemblies across many applications. GAC caches all strong named assembly references within it. All System assemblies that come with the .NET framework reside in the GAC.

96.What is a HashTable?
     
The Hashtable object contains items in key/value pairs. The keys are used as indexes, and very quick searches can be made for values by searching through their keys.

97. What is CAS or Code Access Security?
     
Code Access Security - CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.

98.What is the Composite Custom Control?
     
Combination of existing HTML and Server Controls.

99.What base class do all Web Forms inherit from?
     
System.web.UI.Page class

100.What is the difference between System.String and System.Text.StringBuilder classes?
     
System.String is immutable.
System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

101.How to Create a Cookie?
     
Cookie are one of several ways to store data about web site visitors during the time when web server and browser are not connected. Common use of cookies is to remember users between visits. Practically, cookie is a small text file sent by web server and saved by web browser on client machine.
The“Response.Cookies” command is used to create cookies.

102.How do you identify a Master Page?

The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.

103. Explain what a diffgram is and a good use for one?
      T
he DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

104.How to Manage State in ASP.Net?
     
There are several ways to manage a state.
i.ViewState
ii.QueryString
iii.Cookies
iv.Session
v.Application

105.What are the different types of Caching?
     
There are three types of Caching :
1.Output Caching: stores the responses from an asp.net page.
2.Fragment Caching: Only caches/stores the portion of page (User Control)
3.Data Caching: is Programmatic way to Cache objects for performance.

0 comments:

Post a Comment