Dot Net Interview Questions – Set 17

How is it possible for .NET to support many languages?

The .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code is called managed code. This managed code is run in .NET environment. So after compilation the language is not a barrier and the code can call or use function of another language also.

What is MEF?

MEF stands for Managed Extensibility Framework. It is a library that allows the host application to consume external extensions without any configuration requirement.

What is meant by Globalization and Localization?

Internationalization is the process of designing applications that support multiple languages. This is divided into Localization and Globalization.

Globalization is nothing but developing applications to support different languages. Existing applications can also be converted to support multiple cultures.

Whereas Localization means changing the already globalized app to cater to a specific culture or language Microsoft.Extensions.Localization is used for localizing the app content. Some of the other keywords that are used for Localization are IHtmlLocalizer, IStringLocalizer, IViewLocalizer and so on

What is the code to send an email from an ASP.NET application?

  1. mail message = new mail();
  2. message.From = “abc@gmail.com”;
  3. message.To = “xyz@gmail.com”;
  4. message.Subject = “Test”;
  5. message.Body = “hello”;
  6. SmtpMail.SmtpServer = “localhost”;
  7. SmtpMail.Send(message);

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.

Differentiate between user controls and custom controls.

User and Custom controls inherit from different levels in the inheritance tree. Custom control is designed for use by a single application while user control can be used by more than one application.

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

System.GC.Collect() method.

From which base class all web Forms are inherited?

All web forms are inherited from page class.

Define Method Overriding.

Method Overriding is a process that allows using the same name, return type, argument, and invoking the same functions from another class (base class) in the derived class.

What are the divisions of the Memory Heap?

The memory heap is divided into three generations.

Generation 0 – Used to store short-lived objects. Frequent Garbage Collection happens in this Generation.

Generation 1 – Used for medium-lived objects.

Generation 2 – Used for long-lived objects.