Dot Net Interview Questions – Set 16

What is the difference between a component and a control?

A Component does not draw itself on the form and can be placed below the form area. A control draws itself on the form and can be placed inside the form area. Also, all controls are components, but not all components are controls.

What is manifest in .NET Framework?

Manifest is used to store assembly metadata. It contains all the metadata which are necessary for following things.

  • Version of assembly
  • Security identity
  • Scope of the assembly
  • To resolve references to resources and classes

What are the memory-mapped files?

Memory-mapped files are used to map the content of a file to the logical address of an application. It makes you able to run multiple process on the same machine to share data with each other. To obtain a memory mapped file object, you can use the method MemoryMappedFile.CreateFromFiles( ). It represents a persistent memory-mapped file from a file on disk.

What is MSIL?

MSIL is the Microsoft Intermediate Language, it provides instructions for calling methods, storing and initializing values, memory handling, exception handling and so on. All the .NET codes are first compiled to Intermediate Language.

Explain Different Types of Constructors in C#?

There are 5 types of constructors in C#, as given below:

  • Default Constructor- It is without any parameters.
  • Parameterized Constructor- It has one parameter.
  • Copy Constructor- It creates an object by copying variables from another object.
  • Static Constructor- It is created using a static keyword and will be invoked only once for all of the instances of the class.
  • Private Constructor- It is created with a private specifier and does not allow other classes to derive from this class or create an instance of it.

What is Garbage Collection in .NET?

Garbage Collection in .NET Framework facilitates automatic memory management. It automatically releases the memory space after all the actions related to the object in the heap memory are completed.

What is the difference between managed and unmanaged code?

When developers work within an established framework, they should be aware of certain nuances, especially those between managed and unmanaged code. This question allows you to display your knowledge of working within the framework and to differentiate that knowledge from working in other coding environments.

Answering this question tests the depths of your programming knowledge and lets the interviewer know you are skilled enough to handle the various environments in the enterprise development lifecycle.

Example: “Managed code is managed by and runs inside the CLR and needs the .NET Framework to execute. Unmanaged code, on the other hand, does not need the CLR to execute. Unmanaged code is formulated from a language independent of the .NET Framework and therefore uses its independent environment for execution and compiling.”

Other questions an interviewer could ask to make sure you understand nuanced features of .NET include:

  • Explain the difference between function and stored procedure.
  • What are the different types of assemblies?
  • What are the elements of an assembly?
  • What are the two types of cookies in ASP.NET?

What is the .NET framework?

The .NET framework is a software development platform that supports an object-oriented approach. It offers services, like memory management, networking, security, and type-safety.

.NET is an OOP or an AOP framework?

.NET is an OOP framework as Encapsulation and Inheritance are key features of the Object-Oriented Programming framework.

Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method is used to enforce garbage collection in .Net.