Tuesday, August 17, 2010

Frequently Asked Questions

What is the GAC? What problem does it solve?
GAC stands for Global Access Cache where shareable/public assemblies (DLL)
stored to be used by multiple programs.It gives a shared platform for programs
to use single assembly and can store same assembly (of same name)with different
versions and can help to solve DLL HELL.
What is the difference between an .EXE and a .DLL?
Exe is executable and independent program/process to run which has its own
reserved memory space whereas DLL (Dynamic Link Library) is neither executable
and not even independent,it used by other DLL/program.
Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they
are not inherited. But they are.
What is the difference between .dll extension and .exe extension?
The main difference between .dll and .exe is

.dll is the In process component where it take up the client's memory space to run.
So the communication between the application and component(dll) is very fast.

.EXE is the Out of process component.
It uses its own memory(not application memory) to run the component.
the communication between the application and component is slow when compared to .dll
Explain the 3 types of properties in C# (c-sharp)?
1. Read Only Properties: Properties without a set accessor are considered read-only.
2. Write Only Properties: Properties without a get accessor are considered write-only.
3. Read Write Properties: Properties with both a get and set accessor are considered read-write properties.
What are the advantages of properties in C# (c-sharp)?
1. Properties can validate data before allowing a change.
2. Properties can transparently expose data on a class where that data is actually retrieved from some
other source such as a database.
3. Properties can take an action when data is changed, such as raising an event or changing the value
of other fields.
Is it possible to use multiple inheritance in .Net?
Multiple Inheritance is an ability to inherit from more than one base class i.e. ability of a class
to have more than one super class, by inheriting from different sources and thus combine
separately-defined behaviours in a single class.
There are two types of multiple inheritance: multiple type/interface inheritance
and multiple implementation inheritance.
C# & VB.NET supports only multiple type/interface inheritance,
i.e. you can derive a class/interface from multiple interfaces.
There is no support for multiple implementation inheritance in .Net.
That means a class can only derived from one class.
What are JIT compilers? How many are available in CLR?
Just-In-Time compiler- it converts the language that you write in .Net
into machine language that a computer can understand.
There are two types of JITs one is memory optimized & other is
performance optimized.
How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it’s double colon in C++.
What is Strong Data Typing?
One very important aspect of IL is that it is based on exceptionally Strong Data Typing.
That means that all variables are clearly marked as being of a particular,
specific data type (There is no room in IL, for example Variant data type recognized by
Visual Basic and scripting languages). In particular, IL does not normally permit any
operations that result in ambiguous data types.
In how many ways you can compare two strings in C# using overloaded
methods and operators?
There are three ways:

1. Overloaded Compare() method
2. Overloaded Equal() method
3. Overloaded == operator.

By default the member of the interface are public and abstract. true or false?
True
What is type safety?
Type safety is about increasing the opportunities for the compiler to detect your coding errors.
If you use interfaces instead of delegates the compiler will have more opportunities to detect
your coding errors.
What is the difference between Convert.ToInt32(string)
and Int32.Parse(string)?
The two give identical results, except where the string is null.
Convert.ToInt32(null) returns zero,
whereas Int32.Parse(null) throws an ArgumentNullException.
Can you write a class without specifying namespace?
Which namespace does it belong to by default?
Yes, you can, and then the class belongs to global namespace which has no name.
For commercial products, naturally,you would not want global namespace.


====================================================================

No comments:

Post a Comment