Awanish Welcomes You

awanish tripathi: C#- a breath_breaker

Inspirational & Genius One and the Same

personality shapes your behavior

Tuesday, January 18, 2011

C#- a breath_breaker

Question: Explain the working of CLR.

CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program.
.NET has CLR Following are the responsibilities of CLR
Garbage Collection :- CLR automatically manages memory thus eliminating memory leakes. When objects are not referred GC automatically releases those memory thus providing efficient memory management.
Code Access Security :- CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file.CAS will take care that the code runs under the environment of machines security configuration.
Code Verification :- This ensures proper code execution and type safety while the code runs.It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
IL( Intermediate language )-to-native translators and optimizer’s :- CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.
Question: What is the difference between interface & abstract classes.Explain
Difference Between Interface & Abstract Class:

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.
Both together

When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes. The advantage is that it provides a way for a class to be a part of two classes: one inheritance hierarchy and one from the interface.
When we create an abstract class, we are creating a base class that might have one or more completed methods but at least one or more methods are left uncompleted and declared abstract. If all the methods of an abstract class are uncompleted then it is the same as an interface but with the restriction that it cannot make a class inherit from it. The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.

Difference between CTS and CLS.


The .NET Framework provides a runtime environment called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in Java), which handles the execution of code and provides useful services for the implementation of the program.

Common Type System (CTS) describes how types are declared, used and managed in the runtime and facilitates cross-language integration, type safety, and high performance code execution.
The Common Language Specification (CLS) is an agreement among language designers and class library designers to use a common subset of basic language features that all languages have to follow.

What is JIT? What are types of JIT?
In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the runtime performance of a computer program. JIT builds upon two earlier ideas in run-time environments: byte code compilation and dynamic compilation. It converts code at runtime prior to executing it natively, for example byte code into native machine code. The performance improvement over interpreters originates from caching the results of translating blocks of code, and not simply reevaluating each line or operand each time it is met (see Interpreted language). It also has advantages over statically compiling the code at development time, as it can recompile the code if this is found to be advantageous, and may be able to enforce security guarantees. Thus JIT can combine some of the advantages of interpretation and static compilation.

Several modern runtime environments, such as Microsoft's .NET Framework and most implementations of Java and most recently Action script 3, rely on JIT compilation for high-speed code execution

3. NORMAL JIT compiler.
Explain the Fundamental concept of OOPs.
An object is an abstraction of a real world entity. It may
represent a person,a placea number and icons or something
else that can be modelled.Any data in an object occupy some
space in memory and can communicate with eachother .
A class is a collection of objects having common
features .It is a user defined datatypes which has data
members as well functions that manupulate these datas.
It can be defined as the seperation of unnecessary
details or explanation from system requirments so as to
reduce the complaxities of understanding requirments.
It is a mechanism that puts the data and function together.
It is bthe result of hiding implimintation details of an
object from its user .The object hides its data to de
accessed by only those functions which are packed in the
class of that object.
It is the relationship between two classes of object such
that one of the classes ,the child takes all the relevent
features of other class -the parent.
Inheritance bring about reusablity.
polymorphism means having many forms that in a single
entity can takes more than one form.Polymorphism is
implemented through operator overloading and function
Dynamic binding is the proces of resolving the function to
be associated with yhe respective functions calls during
their runtime rather than compile time.
Every data in an objest in oops that is capable of
processing request known as message .All object can
communicate with each other by sending message to each other
............please Comment...........

No comments:

Post a Comment