- Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
- Describe what an Interface is and how it’s different from a Class.
- What is Reflection?
- What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
- Are the type system represented by XmlSchema and the CLS isomorphic?
- Conceptually, what is the difference between early-binding and late-binding?
- Is using Assembly.Load a static reference or dynamic reference?
- When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
- If an assembly with the same identity is already loaded, LoadFrom will not load it again even the path is different.
- It resolves the dependies using the load path.
- It can be used to load two different assemblies from different path having the same identity.
- It does not resolve dependies using the load path.
- What is an Asssembly Qualified Name? Is it a filename? How is it different?
- Is this valid? Assembly.Load("foo.dll");
- How is a strongly-named assembly different from one that isn’t strongly-named?
- Can DateTimes be null?
- What is the JIT? What is NGEN? What are limitations and benefits of each?
- How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
- What is the difference between Finalize() and Dispose()?
- How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
- What does this useful command line do? tasklist /m "mscor*"
- What is the difference between in-proc and out-of-proc?
- What technology enables out-of-proc communication in .NET?
- When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
This question really ends up being: Give definition of each. And this has not much too do with .Net.
Interface-oriented: Interfaces are used in distributed applications. In such applications the client (caller) and server (callee)
are two separate class implementations and client wants to call functions defined within server class. For that both have to
agree on a particular contract - defining class - that lists what functions are available and what is the signature of each.
The class that declares this contract is Interface. The advantage is that the implementation class (server class) can reside in
separate assembly or separate machine. And the definition of server class can change - the implementation of each method can change.
But as long as the contract/interface remains same the client is not affected.
Object-Oriented: Anyone who comes to .Net world must know this. And next generation will be borned with this knowledge. So no point
in repeating. The point to note is that Interface-oriented programming needs object-oriented programming. OOP is a global umbrella
under which other programming like Interface-oriented resides.
Aspect-Oriented: Well I heard this term recently but haven't dealt with it much. MSDN forum I read (Christian Liensberger)
says this: Aspect-oriented
programming is a way to trace information and do certain things when triggers fire. For example you can do very easy logging in an
aspect-oriented environment. You can specify in a trigger that each time when a method is called another method gets called first.
That one gets the arguments that are passed in the method. You can now log these arguments. Same could also happen when a method is
left... There are many other scenarios where aspect-oriented programming could help.
Good Article on Wikipedia: http://en.wikipedia.org/wiki/Aspect-oriented_programming
Interface is kind of a prototype of the class definition. It contains declaration for methods and
properties available within a class. The class containing actual implementation of these methods and properties is
called Implementation.
A class contains definition of methods, properties and declares member varaibles while Interface only declares the
methods and properties.
Reflection is a mechanism to access class information (meta data) at run time.
Using Reflection one can create objects, understand the definition of classes, its member varaibles,
its properties and its methods. It can dynamically invoke methods.
.Net Remoting works purely using Common Type System. Its not an open standard.
Refer to Link http://www.csharphelp.com/archives2/archive460.html
Good answer here: http://voltinsider.com/?p=64.
In short, XmlSchema has types like xs:Boolean, xs:int, xs:decimal, xs:Date etc.
CLS (Common Language System) has data types like: int, Int32, double, char, boolean etc.
Isomorphism means having similar appearance or one-to-one relation.
XmlSchema and CLS has similar data types. They have almost one-to-one mapping of data types.
Microsoft has a article regarding this: http://support.microsoft.com/default.aspx?scid=kb;en-us;245115
In Short, Binding is a process through which the method calls are matched to the actual code that
implements those methods. In early binding, the calls are bound at the compile time. i.e. programmer
has to know which code is being executed while calling a particular function.
In Late Binding, programmer does not know which code will execute at run time. The run-time will
bind an object that is created at runtime to the function call and executes the relevant code
within that object. Generally the classes that implement IDispatch can be late bound.
The client creates an object of a generic type (Object a = Server.CreateObject("")).
And then a method call on this object for a specific type will be late bound through IDispatch Invoke.
While running your .net application, .Net Runtime loads the assemblies referenced by your application. The reference
to assemblies can be either static or dynamic. Static refenrence means the reference is found in the assembly manifest.
When compiler builds the application, it puts static references in the assembly manifest's meta data.
But if application calls System.Reflection.Assembly.Load("assemblyName") - such references are considered dynamic references.
System.AppDomain.Load() also makes a dynamic (partial) reference to assembly.
Read MSDN Article: http://msdn2.microsoft.com/en-us/library/yx7xezcf(VS.80).aspx
LoadFrom:
LoadFile:
Assembly Qualified name contains: Assembly Name, Version, Culture, Public Key
The fully qualified name is used to locate the assembly and differentiate it from other assembly with the same name.
It's not a file name because it has version, culture and public key.
Example: myAssembly, Version=1.0.1234.0, Culture=en-US, PublicKeyToken=b77a5c561934e089c, ProcessorArchitecture=msil
Read MSDN article here: http://msdn2.microsoft.com/en-us/library/k8xx4k69.aspx
No. Assembly.Load() takes Assembly Name as the parameter and not the file name.
Use Assembly.LoadFrom() or Assembly.LoadFile() to load it from file.
An assembly identity is: Name, Version, Culture, Public Key
Strongly-named assembly identity is: Name, Version, Culture, Public Key and Digital Signature.
Only Strongly-named assemblies can reside in GAC. A strongly-named assembly can only reference
other strongly-named assemblies.
No! Stupid - this is not mid-level question. Its entry level question.
JIT - Just in Time compiler. This is part of .Net runtime. It compiles the
IL code into machine executable code at runtime. This is also called "Jitter".
Limitation of JIT is that the code it generates is not stored/cached anywhere
hence when the same code needs to be executed again, it is regenerated by JIT.
Hence, JIT is slow.
NGEN - is a native image generator for .Net code. NGEN needs the IL code as
input and it generate the native image at specific place. Benefit of
NGEN is that it stores the native code so that it does not have to
be regenerated by JIT everytime its needed. Hence, NGEN code is
faster.
Read this article for more details on NGEN: http://visualbasic.about.com/od/usingvbnet/a/FWTools2.htm
Here is MSDN article on NGEN 2.0: http://msdn.microsoft.com/msdnmag/issues/05/04/NGen/default.aspx#S1
According to MSDN article, the limitation of NGEN 1.0 was that it was
fragile. If any of the dependencies of current assembly changes, for example,
system.dll changes, then the NGEN generated code become invalid and JIT again
uses the IL code.
.Net allocates objects on a memory (managed) heap. For each running application, .Net maintains a set of Application Roots. The Roots
point to storage locations on the managed heap.
Garbage collector traverses all the objects in managed heap through Application Root. If one object points to another, then that object
is considered reachable. At the end it prepares list of unreachable objects. Then it compacts memory by combining all reachable objects
and freeing up memory used by unreachable objects.
Garbage collector divides the objects in three generations: 0, 1 and 2. You could say these are iterations. In the first iteration
(Generation 0) it finds all the reachable and unreachable objects. All reachable objects are promoted to Generation 1. Now, if the
freed-up memory in first iteration (generation 0 unreachable objects) is not enough to allocate then only the next iteration takes place.
Dispose method is called by the user while Finalize() method is called by the Garbage Collector
automatically when the object is to be destroyed.
using() pattern calls the Dispose() method for the object used with it. The class used in using() must implement
IDisposable interface and must have Dispose() method.
E.g. using(MyClass objClass = new MyClass()) { }
Here the MyClass must implement IDisposable. When the execution reaches '}' it calls Dispose() method of the objClass object.
This lists the processes running on the local machine that uses mscor*.dll.
COM servers implemented in DLL are in-proc COM servers and those implementd in EXE are out-of-proc.
Refer this great article on COM Interop: http://www.codeproject.com/useritems/BuildCOMServersInDotNet.asp