.NET - Dynamic Programming

Why should I learn to solve .NET: Dynamic Programming technical interview questions?

Learn and practise solving .NET: Dynamic Programming technical interview questions and answers to enhance your skills for clearing technical interviews, HR interviews, campus interviews, and placement tests.

Where can I get technical .NET: Dynamic Programming technical interview questions and answers with explanations?

IndiaBIX provides you with lots of fully solved .NET: Dynamic Programming technical interview questions and answers with a short answer description. You can download .NET: Dynamic Programming technical interview questions and answers as PDF files or e-books.

How do I answer .NET: Dynamic Programming technical interview questions from various companies?

You can answer all kinds of .NET: Dynamic Programming technical interview questions by practising the given exercises (short answer type). You can also find the frequently asked .NET: Dynamic Programming technical interview questions with answers from various companies, such as TCS, Wipro, Infosys, CTS, IBM, etc.

What is Dynamic Language Runtime (DLR)?
DLR is a runtime environment that allows you to integrate dynamic languages with the Common Language Runtime (CLR) by adding a set of services, such as expression trees, call site caching, and dynamic object interoperability to the CLR.

The System.Dynamic and System.Runtime.CompilerServices namespaces are used to hold the classes for DLR. It also provides dynamic features to statically-typed languages, such as C# and Visual Basic to enable their interoperation with dynamic languages.

What are the advantages of DLR?
The various advantages provided by DLR are:
  • Allows you to easily implement the dynamic languages to the .NET Framework.
  • Provides dynamic features to statically-typed languages. The statically-typed .NET Framework languages, such as C# and Visual Basic can create dynamic objects and use them together with statically-typed objects.
  • Implements sharing of libraries and objects, which means that the objects and libraries implemented in one language can be used by other languages using DLR. The DLR also enables interoperation between statically-typed and dynamic languages.
  • Enables fast execution of dynamic operations by supporting advance caching.

Give a brief introduction to Binders.
Binders are used by DLR to communicate with not the .NET Framework but also with various other services, such as Silverlight and COM. These services represent language-specific semantics and specify how a particular operation can be performed at the call site.

Call sites refer to the area in the code where logical and mathematical operations, such as a + b or a.b() are performed on dynamic objects.

Explain the different services provided by DLR to CLR.
The services provided by DLR to CLR are used for supporting dynamic languages. These services include the following:
  • Expression Trees - Refers to the representation of code in a data structure similar to a tree. However, expression trees in DLR are the advanced version of the expression trees that were introduced with LINQ in .NET 3.5. Therefore, DLR has extended the functionalities of Language Integrated Query (LINQ) expression trees, such as control flow, assignment, and other language-modeling nodes to a dynamic language. These expression trees define the semantics of a language in form of an abstract syntax tree (AST). AST enables the DLR to dynamically generate code, which the CLR executes at runtime.
  • Call Site Caching - Enables the DLR to store the information of the operations and characteristics of the variables, such as their data type. The call site caching services also enables to check whether such operations have been performed previously to retrieve all the information about the variable. The place where DLR stores these values is called a call site.
  • Dynamic Object Interoperability - Enables the DLR to provide a set of classes and interfaces that represent dynamic objects and operations. These classes and interfaces can be used to create classes for dynamic libraries, which can be used in static and dynamic type languages.