.Net (dot Net) Interview Questions
What is .NET?
NET is an integral part of many applications running on Windows and provides common functionality for those applications to run. This download is for people who need .NET to run an application on their computer. For developers, the .NET Framework provides a comprehensive and consistent programming model for building applications that have visually stunning user experiences and seamless and secure communication.
How many languages .NET is supporting now?
When .NET was introduced it came with several languages.
What is an IL?
Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
What is code access security (CAS)?
Code access security (CAS) is part of the .NET security model that prevents unauthorized access of resources and operations, and restricts the code to perform particular tasks.
What is Difference between NameSpace and Assembly?
Assembly is physical grouping of logical units, Namespace, logically groups classes.
Namespace can span multiple assembly.
Mention the execution process for managed code.
A)Choosing a language compiler
B) Compiling the code to MSIL
C) Compiling MSIL to native code
D) Executing the code.
What is Microsoft Intermediate Language (MSIL)?
The .NET Framework is shipped with compilers of all .NET programming languages to develop programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the source code. The intermediate code is common for all languages and is understandable only to .NET environment. This intermediate code is known as MSIL.
What is managed extensibility framework?
Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.
Which method do you use to enforce garbage collection in .NET?
The System.GC.Collect() method.
What is the difference between int and int32.
There is no difference between int and int32. System.Int32 is a .NET Class and int is an alias name for System.Int32.
What are tuples?
Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.
What is the full form of ADO?
The full form of ADO is ActiveX Data Object.
What are the two fundamental objects in ADO.NET?
DataReader and DataSet are the two fundamental objects in ADO.NET.
What is the meaning of object pooling?
Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.
Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.
The System.Data.SqlClient namespace.
Which architecture does Datasets follow?
Datasets follow the disconnected data architecture.
What is the role of the DataSet object in ADO.NET?
One of the major component of ADO.NET is the DataSet object, which always remains disconnected from the database and reduces the load on the database.
Which property is used to check whether a DataReader is closed or opened?
The IsClosed property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.
Name the method that needs to be invoked on the DataAdapter control to fill the generated DataSet with data?
The Fill() method is used to fill the dataset with data.
What are the pre-requisites for connection pooling?
There must be multiple processes to share the same connection describing the same parameters and security settings. The connection string must be identical.
Which adapter should you use, if you want to get the data from an Access database?
OleDbDataAdapter is used to get the data from an Access database.
What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?
The Windows Authentication option
The SQL Server Authentication option
What are the parameters that control most of connection pooling behaviors?
Max Pool Size
What is AutoPostBack?
If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.
What is the function of the ViewState property?
The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can enable the view state to an individual control even if the view state for an ASP.NET page is disabled.
Which properties are used to bind a DataGridView control?
The DataSource property and the DataMember property are used to bind a DataGridView control.
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).
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
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.
Which is the parent class of the Web server control?
The System.Web.Ul.Control class is the parent class for all Web server controls.
What are the advantages of the code-behind feature?
i)Makes code easy to understand and debug by separating application logic from HTML tags
ii)Provides the isolation of effort between graphic designers and software engineers
iii)Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.
Define a multilingual Web site.
A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.
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.
How can you register a custom server control to a Web page?
You can register a custom server control to a Web page using the @Register directive.
Which ASP.NET objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.
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.
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.
Which method is used to force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to perform validation.
What does the Orientation property do in a Menu control?
Orientation property of the Menu control sets the horizontal or vertical display of a menu on a Web page. By default, the orientation is vertical.
Differentiate between client-side and server-side validations in Web pages.
What is garbage collection?
Garbage collection is a heap-management strategy where a run-time component takes responsibility for managing the lifetime of the memory used by objects. This concept is not new to .NET – Java and many other languages/runtimes have used garbage collection for some time.
What is serialization?
Serialization is the process of converting an object into a stream of bytes.Deserialization is the opposite process, i.e. creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).
Where do you add an event handler?
It’s the Attributesproperty, the Add function inside that property. e.g.btnSubmit.Attributes.Add(“onMouseOver”,”someClientCode();”)
What do you mean by authentication and authorization?
Authentication is the process of validating a user on the credentials(username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.
What is portable executable (PE) ?
The file format used for executable programs and for files to be linked together to form executable programs
Differences between DLL and EXE?
1.These are outbound file.
2.Only one .exe file exists per application.
3..Exe cannot be shared with other applications.
1.These are inbound file .
2.Many .dll files may exists in one application.
3. .dll can be shared with other applications.
What is shadowing?
Shadowing is either through scope or through inheritance. Shadowing through inheritance is hiding a method of a base class and providing a new implementation for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridden in the base class. This also serves the purpose of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.’shadows’ keyword is recommended although not necessary since it is the default.
What is Method Overriding? How to override a function in C#?
An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
Use the override modifier to modify a method, a property, an indexer, or an event. You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.
Differences between dataset.clone and dataset.copy?
Clone – Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.
Copy – Copies both the structure and data for this DataSet.
What is the managed and unmanaged code in .net?
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. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.
Whats an assembly?
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.
How do you create a permanent cookie?
Setting the Expires property to MinValue means that the Cookie never expires.
What’s a Windows process in .NET?
Windows process is an application that’s running and had been allocated memory in .NET
What is Delegation in .NET?
A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method’s class.
What is Serialization in .NET?
The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)
Difference between Class And Interface in .NET?
Class is logical representation of object. It is collection of data and related sub procedures with definition.
Interface is also a class containing methods which is not having any definitions.
Class does not support multiple inheritance. But interface can support
Can any object be stored in a Viewstate in .NET?
An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState.
What is the use of ErrorProvider Control in .NET?
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.
How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for validation of any controle.
We have Range Validator, Email Validator in .NET to validate any control.
How to manage pagination in a page using .NET?
Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.