.NET Interview Questions and Answers
ANS: .NET is essentially a framework for software development. It is similar in nature to any other software development framework (J2EE etc) in that it provides a set of runtime containers/capabilities, and a rich set of pre-built functionality in the form of class libraries and APIs
2. What is .Net Framework?
ANS: The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.
3. Is .Net Platform Independent?
ANS: .NET is platform independent because mono organization found a framework to run in linux. it is independent because it is having clr which is used for compiling once and can run anywhere.
4. What is smart navigation?
ANS: The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
5. How many languages .NET is supporting now?
ANS: When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc.
6. How is .NET able to support multiple languages?
ANS: A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
7. What is an Interface in NET?
ANS: Interface contains only the declaration for its abstract members (events, methods, properties). Any implementation must be placed in class that implements them. Interface is the only way that lets us the implement multiple inheritance. The interface cannot contain constants, data fields, constructors, and destructors.
8. How many types of assemblies are there, what are they?
ANS: Assembly is collection of compiled or executable components which versioned and deployed as single implementation unit.
Assemblies are two types
1. Private assembly- can be accessed only by single application
2. Shared assembly-can be accessed by multiple applications in a system.
9. Garbage collection in .Net?
ANS: .Net Frameworks -Memory Management Garbage Collector which manages allocation and release of memory from application. Garbage collector automatically manages memory on application.
10. What is view state in .NET?
ANS: The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. This is done automatically by the ASP.NET. This can be switched off / on for a single control
11. What is xml reader?
ANS: The xml reader class helps in to get xml data in stream or xml documents. This class provides fast, non-cacheable, read only access to xml data as the name suggest it is only forward only access.
12. Can we run dot.Net in UNIX platform?
ANS: Yes, we can use .NET in UNIX platform using monotools.
Mono Tools for Visual Studio is a commercial add-in for Microsoft(TM) Visual Studio(TM) that enables developers to write .NET applications for non-Windows platforms within their preferred development environment.
13. What is CLR?
ANS: Common Language Runtime (CLR) is a run time environment that manages the execution of .NET code and provides services like memory management, debugging, security,, etc. The CLR is also known as Virtual Execution System (VES).
14. How many classes can a single .NET DLL contain?
ANS: One DLL can contains many class, dll wil be created by using class library project.
15. What is intermediate language in .NET?
ANS: MSIL is Microsoft Intermediate Language. When we compile .Net applications, its complied to MSIL, which is not machine read language. Hence Common Language Runtime (CLR) with Justin Time Complier (JLT), converts this MSIL to native code (binary code), which is machine language.
16. What is the base class of .Net?
ANS: The base class of all server controls is Control class that resides in System.Web.UI comes from the system. object. All the object of type either value or reference type come from system. object. see the msdn doc for the same.
17. What is GAC in .NET?
ANS: The global assembly cache 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.
Assemblies deployed in the global assembly cache must have a strong name. When an assembly is added to the global assembly cache, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with.
18. What platforms does the .NET Framework run on?
ANS: The .Net Framework runs on
Windows Server 2003,
Windows 2000, NT Server 4.0,
Windows 98, or Windows ME.
19. What is reflection in Microsoft .NET Context?
ANS: The REFLECTION is used to read the metadata information like(type, reference and methods). Which is derived from system.assembly.reflection class object.
The simple meaning is to read assembly information by using this system.assembly.reflection class.
20. Explain .NET architecture and framework?
ANS: .NET Framework is an Integrity of Windows Component which is used to develop Web Applications, Windows, Console Application and Web services.
.NET architecture is basically a collection of services and classes. This exists as a layer between .NET applications and underlying operating systems.
21. What are code groups in .NET?
ANS: Code group is a logical grouping of code that follows some given conditions for membership. Code groups have some permission sets that are checked before to grant the membership of the code group.