Top 100 Dotnet Interview Questions and Answers
1.What is ASP?
Active Server Pages (ASP), also known as Classic ASP, is a Microsoft’s server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser.
2.What is ASP.NET?
ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#.
3.What is the basic difference between ASP and ASP.NET?
The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).
4.What is IIS? Why is it used?
Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.
5.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 view state is not fully loaded during this event.
6.What is AutoPostBack?
Autopostback is the mechanism by which the page will be posted back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back, if set to true, will send the request to the server when an event happens in the control.
7.How can we identify that the Page is Post Back?
Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.
8.Which is the parent class of the Web server control?
The System.Web.UI.Control class is the parent class for all Web server controls.
9.What is ViewState?
The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.
10.Where is the ViewState information stored?
The ViewState information is stored in the HTML hidden fields.
11.What is the lifespan for items stored in ViewState?
The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.
12.What is the difference between authentication and authorization?
Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words, you can say that authentication is a procedure of getting some credentials from the users and verify the user’s identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.
Authorization means does he have access to a particular resource on the IIS website. A resource can be an ASP.NET web page, media files (MP4, GIF, JPEG etc), compressed file (ZIP, RA
13.What are the various ways of authentication techniques in ASP.NET?
Windows Authentication – This mode works as the default authentication technique. It can work with any form of Microsoft Internet Information Services (IIS) authentication, such as Basic, Integrated Windows authentication (NTLM/Kerberos), Digest, and certificates. The syntax of Windows authentication mode is given as follows: <authentication mode=”windows” />
Forms Authentication – You can specify this mode as a default authentication mode by using the following code snippet: <authentication mode=”Forms”/>
Passport – This mode works with Microsoft Passport authentication, as shown in the following code snippet:<authentication mode = “Passport”/>
Passport authentication is based on the passport website provided by the Microsoft .So when user logins with credentials it will be reached to the passport website ( i.e. hotmail,devhood,windows live etc) where authentication will happen. If Authentication is successful it will return a token to your website.
14.What setting must be added in the configuration file to deny a particular user from accessing the secured resources?
To deny a particular user form accessing the secured resources, the web.config file must contain the following code:
<deny users=”username” />
15.Differentiate globalization and localization.
The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.
Globalization is the process of designing the application in such a way that it can be used by users from across the globe (multiple cultures). Localization, on the other hand, is the process of customization that we do to have our application behave as per current culture and locale.
16.What are the event handlers that can be included in the Global.asax file?
The Global.asax file contains some of the following important event handlers:
17.Describe the complete lifecycle of a Web page.
When we execute a Web page, it passes from the following stages, which are collectively known as Web page lifecycle:
Page request – During this stage, ASP.NET makes sure the page either parsed or compiled and a cached version of the page can be sent in response
Start – During this stage sets the Request and Response page properties and the page check the page request is either a postback or a new request
Page Initialization – During this stage, the page initialize and the control’s Unique Id property are set
Load – During this stage, if the request is postback, the control properties are loaded without loading the view state and control state otherwise loads the view state
Validation – During this stage, the controls are validated
Postback event handling – During this stage, if the request is a postback, handles the event
Rendering – During this stage, the page invokes the Render method to each control for return the output
Unload – During this stage, when the page is completely rendered and sent to the client, the page is unloaded.
18.How can you assign page specific attributes in an ASP.NET application?
The @Page directive is responsible for this.
19.What is State Management? How many ways are there to maintain a state in .NET?
State management is used to store information requests. The state management is used to trace the information or data that affect the state of the applications.
There are two ways to maintain a state in .NET, Client-Based state management and Server- Based state management.
The following techniques can be used to implement the Client-Based state management:
The following techniques can be used to implement Server-Based state management:
20.What are the major built-in objects in ASP.NET?
The major built-in objects in ASP.NET are as follows:
21.What is a round trip?
The trip of a Web page from the client to the server and then back to the client is known as a round trip.
22.What is a base class and derived class?
A class is a template for creating an object. The class from which other classes derive fundamental functionality is called a base class. For e.g. If Class Y derives from Class X, then Class X is a base class.
The class which derives functionality from a base class is called a derived class. If Class Y derives from Class X, then Class Y is a derived class.
23.How do you prevent a class from being inherited?
In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a base class. In C#, use the sealed keyword.
Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.
25.What is an Interface?
An interface is a standard or contract that contains only the signatures of methods or events. The implementation is done in the class that inherits from this interface. Interfaces are primarily used to set a common standard or contract.
26.What is a connection pool?
A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.
27.What is Boxing/Unboxing?
Boxing is used to convert value types to object. E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type. E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.
28.What is garbage collection?
Garbage collection is the process of managing the allocation and release of memory in your applications.
29.What is the difference between custom controls and user controls?
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.
30.Difference between Response.Redirect and Server.Transfer?
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.
31.What are the types of Authentication in ASP.NET?
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.
32.What are Session state modes in ASP.NET?
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.
33.What is the Microsoft.NET?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services. It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications.
34.What is the .NET Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft’s managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.
35.What is CLR?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.
36.What is CTS?
Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross- language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
37.What is CLS
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.
38.What is managed code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code.
39.What is MSIL?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
40.What is JIT?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
41.What is an assembly?
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.
42.What are the contents of assembly?
A static assembly can consist of four elements:
Assembly manifest – Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.
- Type metadata – Binary information that describes a program.
- Microsoft intermediate language (MSIL) code.
- A set of resources.
43.What are the different types of assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for an application.
44.What is a dynamic assembly?
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies.
45.What is GAC? What are the steps to create an assembly and add it to the GAC?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
46.What is a garbage collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.
47.What is the difference between value type and reference type?
Value type contain variable and reference type are not containing value directly in its memory.
Memory is allocated in managed heap in reference type and in value type memory allocated in stack. Reference type ex-class value type-struct, enumeration
48.What are the differences between Application object and session object?
application[“name”] = txtUser.Text
Session[“name”] = txtUser.Text
The session object is used to maintain the session of each user. If one user enter in to the application then they get session id if he leaves from the application then the session id is deleted. If they again enter in to the application they get different session id.
But for application object the id is maintained for whole application.
49.What are differences between Array list and Hash table?
1) Hash table store data as name, value pair. While in array only value is store.
2) To access value from hash table, you need to pass name. While in array, to access value, you need to pass index number.
3) you can store different type of data in hash table, say int, string etc. while in array you can store only similar type of data.
50.What are differences between system.stringbuilder and system.string?
The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.
Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.
51.What do you know about JIT?
JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native language. During the execution, the intermediate code is converted into the native language.
52.Why do we use Response.Output.Write()?
Response.Output.Write() is used to get the formatted output.
53.What is the difference between managed and unmanaged code?
|Managed code||Unmanaged code|
|Managed code is managed by CLR||Any code that is not managed by CLR|
|.NET framework is necessary to execute managed code||Independent of .NET framework|
|CLR manages memory management through garbage collection||Own runtime environment for compilation and execution|
54.Explain the difference between a class and an object?
|Class is the definition of an object||An object is an instance of a class.|
|It is a template of the object||A class does not become an object unless instantiated|
|It describes all the methods, properties, etc||An object is used to access all those properties from the class.|
55.What is BCL?
BCL is a base class library of classes, interfaces and value types
It is the foundation of .NET framework applications, components, and controls
Encapsulates a huge number of common functions and make them easily available for the developers
It provides functionality like threading, input/output, security, diagnostics, resources, globalization, etc.
Also serves the purpose of interaction between user and runtime
It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.
56.What is the difference between namespace and assembly?
An assembly is a physical grouping of logical units whereas namespace groups classes. Also, a namespace can span multiple assemblies as well.
57.What is LINQ?
It is an acronym for Language integrated query which was introduced with visual studio 2008. LINQ is a set of features that extend query capabilities to the .NET framework language syntax that allows data manipulation irrespective of the data source. LINQ bridges the gap between the world of objects and the world of data.
58.From which base class all web Forms are inherited?
All web forms are inherited from page class.
59.What are the different types of constructors in c#?
Following are the types of constructors in C#:
60.What are the different types of assemblies?
There are two types of assemblies:
Private Assembly: It is accessible only to the application, it is installed in the installation directory of the application.
Shared Assembly: It can be shared by multiple applications, it is installed in the GAC.
61.What is the difference between custom and user control?
|Custom Control||User Control|
|Derives from control||Derives from UserControl|
|Dynamic Layout||Static Layout|
|Defines a single control||Defines a set of con|
|It has full toolbox support||Cannot be added to the toolbox|
|Loosely coupled control||Tightly coupled control|
62.What is caching?
Caching simply means storing the data temporarily in the memory so that the data can be accessed from the memory instead of searching for it in the original location. It increases the efficiency of the application and also increases its speed.
Following are the types of caching:
MVC stands for model view controller which is an architecture to build .NET applications.
Model: They are the logical part of any application that handles the object storage and retrieval from the databases for an application.
View: View handles the UI part of an application. They get the information from the models for their display.
Controller: They handle the user interactions, figure out the responses for the user input and also render the view that is required for the user interaction.
64.Difference between interface and abstract class in .NET?
|An interface merely declares a contract or behavior that implementing classes should have.||An abstract class provides a partial implementation for a functionality that must be implemented by the inheriting entities.|
|An interface may declare only properties, methods and events with no access modifier.||An abstract class declares fields too.|
Neither interface nor an abstract class can be instantiated.
65.What is the difference between a stack and a heap?
|Stored value type||Stored reference type|
|A stack is responsible for keeping track of each executing thread and its location.||The heap is responsible for keeping track of the more precise objects or data.|
66.What are EXE and DLL?
EXE and DLL are assembly executable modules.
EXE: It is an executable file that runs the application for which it is designed. When we build an application, an exe file is generated. Therefore the assemblies are loaded directly when we run an exe. But an exe file cannot be shared with other applications.
DLL: It stands for dynamic link library that consists of code that needs to be hidden. The code is encapsulated in this library, an application can have many DLLs and can also be shared with other applications.
67.What is the difference between function and stored procedure?
|Must return a single value||Always used to perform a specific task|
|It can only have the input parameter||It can have both input and output parameters|
|Exception handling is not possible using a try-catch block||Exception handling can be done using a try-catch block|
|A stored procedure cannot be called from a function||A function can be called from a procedure|
68.What is cross-page posting?
Whenever we click on a submit button on a page, the data is stored on the same page. But if the data is stored on a different page, it is known as a cross-page posting.
Cross-page posting can be achieved by POSTBACKURL property which causes the postback.
FindControl method can be used to get the values that are posted on this page to which the page has been posted.
69.Explain passport authentication.
During the passport authentication, it first checks the passport authentication cookie, if the cookie is not available the application redirects to the passport sign on page. Passport service then authenticates the details of the user on the sign on page and if they are valid, stores them on the client machine and then redirects the user to the requested page.
70.What is MIME?
MIME stands for multipurpose internet mail extensions, it is the extension of the e-mail protocol which lets users use the protocol to exchange files over the internet. Servers insert the MIME header at the beginning of the web transmission. Then the clients use this header to select an appropriate ‘player’ for the type of data that the header indicates. Some of these players are built into the web browser.
Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.
72.In which event of page cycle is the ViewState available?
After the Init() and before the Page_Load().
73.What are the different validators in ASP.NET?
Required field Validator
Regular expression Validator
74.Which validator control you use if you need to make sure the values in two different controls matched?
Compare Validator control.
75.What is the difference between web config and machine config?
Web config file is specific to a web application where as machine config is specific to a machine or server. There can be multiple web config files into an application where as we can have only one machine config file on a server.
76.What does CLR stand for in .NET?
CLR stands for Common Language Runtime. It forms to be the most vital component of .NET as it provides the foundation for many applications to run on.
If a user writes an application in C#, it gets compiled and converted to intermediate code. After this, CLR takes up the code and works on it with respect to the following aspects:
Libraries for loading
77.What is the difference between a function and a stored procedure in .NET?
|Can only return one value||Can return any number of values|
|No support for exception handling using try-catch blocks||Supports the usage of try-catch blocks for exception handling|
|The argument consists of only one input parameter||Both input and output parameters are present|
|A function can be called from a stored procedure||The stored procedure cannot be called from a function|
78.What are some of the advantages of using a session?
There are numerous advantages of making use of a session as mentioned below:
It is used to store user data across the span of an application.
It is very easy to implement and store any sort of object in the program.
Individual entities of user data can be stored separately if required.
The session is secure, and objects get stored on the runtime server.
79.Is it possible to manually set a timeout for a session in .NET?
Yes, it is possible to manually set a session’s out time. It can easily be done by manipulating the web.config file.
80.What is the meaning of AutoPostBack in .NET?
AutoPostBack is a property in the .NET framework, which provides automatic postback whenever an event starts its execution cycle. To use AutoPostBack, you have to set the property to True.
81. How is the status of a DataReader checked in .NET?
The status of a DataReader can be checked easily by using a property called ‘IsClosed.’ It will tell you if the DataReader is closed or opened.
If it is closed, a true value is returned, and if the reader is open, it returns a false value.
82.Explain the request flow in ASP.NET MVC framework.
Request flow handles the request from the clients and passes it to the server. Request hits the controller coming from the client. Controller plays its role and decides which model to use in order to serve the request further, passing that model to view which then transforms the model and generates an appropriate response that is rendered to the client.
83.Define a connection string in Web.config file?
Answer: Connection string contains information about the data source and how to connect to it.
<add name=”myConnection” connectionString=”server=localhost;database=mydatabase;” />
84.Explain Cookies in ASP.NET?
A cookie is a part of text that stores user-specific data. Cookies are stored by the browser in a user’s hard drive and used whenever the user requests for a particular page. Cookies help in improving user experience and loading pages faster based on the date and time information stored as part of the data. In ASP, cookies can be created as well as retrieved.
85. What are the two types of cookies in ASP?
86.Explain the purpose of Web Services in ASP.NET?
ASP.NET can create web services which are nothing but programs that use XML to exchange data with other software programs through commonly used internet protocols. We can communicate with any object over the internet using web service.
Web services are language-independent, platform-independent, protocol-independent, self-describing and programmable.
87.What is Query String in ASP? And what are its advantages and disadvantages?
A query string is a method of transporting data from page to page using the browser URL. It is attached to the URL using the question mark symbol (?).
Advantages: Easy to use, no server resources required, supported by all the browsers, contained in the HTTP request of the URL
Disadvantages: URL length cannot be greater than 255 characters; data is directly visible to everyone compromising the security.
88.Explain the HTML server controls in ASP.NET?
HTML server controls provide automatic state and server-side event management. These are HTML elements that have the attribute runat=server. The HTML server control properties and output are the same as their equivalent HTML tags. These controls are compiled when the ASP.NET application is compiled.
89.What is the difference between session and application object?
The difference between session and application object is that all users share one Application object and with sessions, there is one session object for each user. Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key-value pair. Session object stores session-specific information and the information are visible within the session only. ASP.NET creates unique SessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the applications configuration settings. By default, SessionID values are stored in cookies.
90.What is ASP.NET AJAX?
91.What is Razor in ASP.NET
Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages. The server-based code can create dynamic web content on the fly, while a web page is written to the browser. When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser. By running on the server, the code can perform complex tasks, like accessing databases. Razor is based on ASP.NET, and designed for creating web applications. It has the power of traditional ASP.NET markup, but it is easier to use and easier to learn.
92.What is ASP.NET Core?
ASP.NET Core is the open-source and cross-platform version of ASP.NET. The Windows-only versions of ASP.NET, that existed before ASP.NET Core, is typically just referred to as ASP.NET.
93.What is FCL?
FCL stands for Framework Class Library, and is a collection of reusable types, including classes, interfaces, and data types included in the .NET Framework. It is used for developing a wide variety of applications, as it provides access to system functionality.
94.Discuss the difference between constants and read-only variables.
Constant fields are created using const keyword and their value remains the same throughout the program. The Read-only fields are created using a read-only keyword and their value can be changed. Const is a compile-time constant while Read-only is a runtime constant.
95.What are the types of Polymorphism?
There are two types of Polymorphism:
Static or compile-time polymorphism
Dynamic or runtime polymorphism
96.Do we have multiple inheritances in .NET? Why?
No, .NET supports only single inheritance due to the diamond problem. Also, it would add complexity when used in different languages. However, multiple interfaces can solve the purpose.
97.What is an Interface?
An interface is a declaration for a set of class members. It is a reference type that contains only abstract members such as Events, Methods, Properties, etc.
98.What are the events and delegates?
Events notify other classes and objects when the desired action occurs in a class or object. A delegate is a type-safe function pointer that defines a method signature in CLI.
99.What is business logic?
It is the application processing layer that coordinates between the User Interface Layer and Data Access Layer.
100.What is a Hashtable?
The Hashtable class is a collection that stores key-value pairs. It organizes the pairs based on the hash code of each key and uses it to access elements in the collection.