Monday, December 29, 2008

Assemby Thirty Points

Dev Palmistry

1. The complied file with IL code is an Assemby.

2. Assemblies are self-descrbing installation units , consisting of one or more files.

What is the meaning of self-desctibing means ?
Ans: Self-describing means have metadeta.

(MetaData : Data about data)

A. Assembly include metadeta that descibes the Assemblies.

3. Assembies are found in bin directry and GAC (Global Cache Assembly)

a. Application Directroy- bin- It Containts the pre-complied pages and wev services class . You can directly use these assemblies in ur applications.

4. Each Assembly has a version number.

5. Assembly is basic building block of .Net application.

6. Assembly may contain the following Contains :

. Assembly Menifest.
.Source Code - Complied code Il
Type Meta Data
Resources - icons, images, text strings and other resources.

7. Example of Assembly - Dll file contains the application code , the .aspx file, .ascx user controls
.gif , .bmp, .ico files and other files like resource file.

8. An Assembly contains the MISL code , which the Common Language Runtime (CLR) executes , and the type metadata.

9 When the Comman Language Runtime (CLR) loades and assembly , it first reads the manifist
to get the information regarding Assembly.

10 .Component are pre-complied set of classes that have been developed in the form of DLL fliles and can then be included within our projects. This is also known as an Assembly.

11. Asp.Net lookes for class files in the bin directry.

12. Assembly means complied code file.

13 Assemblies are related to CLR

14. Assemblies are belongs to the .Net Framework.

15. Assembly is a portable executabls file that contains a complied portion of code.

16 .Assembly is especially designed for deployment purpose such as the *.JAR files that are used in Java context.

17 . When an application is Developed against an assembly , it depends on it, therefore it needs to cocate it and explote it s services when runing. First of all the Comman Language Runtime (CLR) ,which is responsible for execting the application program , varifies if the assiembly is already referenced and used , if this is not the case , it search it in the application bin directory,
after that it is checked in the Global Cache Assembly (GAC) , in a final step , the CLR checks information about the targeted assembly in the configuration file . In this step the code location in the configuration information about the target assembly , when the assembly is not found , an error massage occure , Add a message like this can be found in the error list :

Error : The type or namespace name Assembly could not be found (are you missing a using directive or assemby reference).

18. Each Assembly has a Version no. All the types and resources in an Assembly share the same Version no. to take easy for application to refer to the correct version of the file and avoid problem of "DLL Hell".

19. CLR is the place where the .Net application code gets complied and complied code is as Assemblies.

20 . Assemblies are made of two parts :

Manifeast
Module

Manifest : Mnaifest , contains information about what is containd within the assembly and
Module : modules, internals files of IL code which are ready to run (execurte)

21 . Assembly is complied collection code. Complied versioned collection of code.

22. Assembly is a self -describing collection of code , resources and metadata.

23. Assembly take form of a dyanamic link library (.DLL) file or executetable program file (.EXE) .

24 . An Assembly Includes :

# Information for each public class or type used in the assembly - information includes class or type names, the classes from which an individual class is derived, etc.

# Information on all public methods in the each class , like , the name method and return values (if any).

# Information on every public parameter for each method like parameter's name and type.

# Information on Public enumerations including name and values .

# Information on the assembly version (each assembly has specific version number)

# Intermediate Language (IL) code to execute (to run).

# A list of types exposed by the assembly and list of other assemblies required by other assembly.

25. Whem programming , we dont need to directly deal with assemblies as the CLR and the .Net framework take care of that behind the scencs.

26. Assembly files is visible in the Solution Explorer Window of the project.

27. There are two types of Assemblies :

Private
Shared

28. Feature of Assemblies :

# Assemblies are self- describing.

# Assemblies can be loaded side -by -side.

# Installation can be as easy as copying the files that belongs to an assembly . An Xcopy is enough.

# Application isolation is ensured using application domain.

# Version Dependencies are recorded inside an assembly menifest.

# An assembly is the .Net term for deploying and configuration unit.

What is the Side-by Side feature ?

Ans: Window 2000 introduce the side -by - feature , which allows the installtionof the Dll in the application. With side-by side , you can instal a different version of an already instaled shared Dll to the directry of the application.


29. Assmby is loaded into an AppDomain.

AppDomain : Application Domain (AppDomain) allows you to have One Win 32 process that can be diveded into seperate areas of execution that are protected from other.
Suppoese that yor have a task that needs to be done , but you want to make sure that if that task fails and throw unhandled exception , the entire pricess does not shut down.
That is exactly what application domain do for you . This allows you to create sepereate execution contaxt inside the same Win32 process.

The .Net Runtime (LCR) enforces AppDomain isolation by keepingcontrol over the use of memory.All memory in AppDomain is managed by the .Net Runtime (LCR) , so the runtime ensure that AppDomains do not access each others memory.

.Net applications work within an application domain.

An AppDomain can be seen as a subprocess within a process.

With .Net , the AppDomain is the new safty boundry inside a process , because the MSIL code is type-safe and varifable.

30. You can unload assemblies only terminating application domain.



Note: For the biginers it is confusing that Assembly is compled code or executed code. So let me clear this confusition That Assembly is complied code. CLR load assembly and jit execute this assembly.

Abstract Class

Abstract ClassesAbstract classes can be simply defined as incomplete classes.
Abstract classes contain one or more incomplete methods called abstract methods.
The abstract class only provides the signature or declaration of the abstract methods and leaves the implementation of these methods to derived or sub-classes.
Abstract methods and abstract classes are marked with the abstract keyword.
An abstract class itself must be marked with the abstract keyword.
Since abstract classes are incomplete, they can not be instantiated. They must be sub-classed in order to use their functionality. This is the reason why an abstract class can't be sealed.
A class inheriting an abstract class must implement all the abstract methods in the abstract class, or it too must be declared as an abstract class.
A class inheriting an abstract class and implementing all its abstract methods is called the concrete class of the abstract class.
We can declare a reference of the type of abstract class and it can point to the objects of the classes that have inherited the abstract class. Let us declare an abstract class with two concrete properties and an incomplete (abstract) method. abstract class TaxCalculator
{
protected double itemPrice;
protected double tax;

public abstract double CalculateTax();

public double Tax
{
get { return tax; }
}
public double ItemPrice
{
get { return itemPrice; }
}
}The TaxCalculator class contains two fields: itemPrice and applied tax. It contains an abstract method CalculateTax() which calculates the tax applied on the itemPrice and stores it in the field tax. The CalculateTax() method is made abstract so the concrete sub-classes can provide their own criteria for applying the tax on the itemPrice. The class also contains two public read only properties used to access the two private fields. If we try to instantiate this abstract class in the Main() method static void Main()
{
TaxCalculator taxCalc = new TaxCalculator();
}The compiler will complain like:Cannot create an instance of the abstract class or interface 'CSharpSchool.TaxCalculator'In order to create an instance of the TaxCalculator class, we need to sub-class it. Let us now inherit a class from the abstract TaxCalculator class calling it SalesTaxCalculator. class SalesTaxCalculator : TaxCalculator
{
public SalesTaxCalculator(double itemPrice)
{
this.itemPrice = itemPrice;
}
public override double CalculateTax()
{
tax = 0.3 * itemPrice;
return itemPrice + tax;
}
}The SalesTaxCalculator class inherits the TaxCalculator and overrides its CalculateTax() method. It applies 30% tax on the price of an item (a bit harsh!) and returns the new price of the item. The SalesTaxCalculator class also defines a constructor that takes itemPrice as its parameter. If we don't provide the implementation of the CalculateTax() method in SalesTaxCalculator class SalesTaxCalculator : TaxCalculator
{
public SalesTaxCalculator(double itemPrice)
{
this.itemPrice = itemPrice;
}
/* public override double CalculateTax()
{
tax = 0.3 * itemPrice;
return itemPrice + tax;
}*/
}We will get a compile time error:'CSharpSchool.SalesTaxCalculator' does not implement inherited abstract member 'CSharpSchool.TaxCalculator.CalculateTax()'Now, un-comment the overridden CalculateTax() method in SalesTaxCalculator. Since we have overridden the CaculateTax() method of TaxCalculator in the SalesTaxCalculator class, we can create its instance in the Main() method.class Test
{
static void Main()
{
SalesTaxCalculator salesTaxCalc = new SalesTaxCalculator(225);
double newPrice = salesTaxCalc.CalculateTax();
Console.WriteLine("The item price has changed
because of sales tax from {0} $ to {1} $",
salesTaxCalc.ItemPrice, newPrice);
Console.WriteLine("Tax applied = {0} $", salesTaxCalc.Tax);
}
}Here, we have instantiated the SalesTaxCalculator class just like a regular class and accessed its members. The output of the above program will be:The item price has changed because of sales tax from 225 $ to 292.5 $Tax applied = 67.5 $Press any key to continueWe can also use an abstract class type (TaxCalculator) reference to handle an object of its concrete class (SalesTaxCalculator) in our Main() method.static void Main()
{
TaxCalculator taxCalc = new SalesTaxCalculator(225);
double newPrice = taxCalc.CalculateTax();
Console.WriteLine("The item price has changed because of
sales tax from {0} $ to {1} $", taxCalc.ItemPrice, newPrice);
Console.WriteLine("Tax applied = {0} $", taxCalc.Tax);
}We can derive as many concrete classes as we want from the abstract TaxCalculator class, as long as they provide the definition of its abstract methods. Here is another concrete class (WarSurchargeCalculator) of the abstract TaxCalculator class.class WarSurchargeCalculator : TaxCalculator
{
public WarSurchargeCalculator(double itemPrice)
{
this.itemPrice = itemPrice;
}
public override double CalculateTax()
{
tax = 0.5 * itemPrice;
return itemPrice + tax;
}
}The WarSurchargeCalculator can be used similarly in the Main() method.


Link for C# biginers
http://www.programmersheaven.com/2/Les_CSharp_0

Tuesday, December 9, 2008

.Net Questions and Answer of Different Companies

Dev Palmistry

Rose IT New Delhi 10 July 2007


Question1 : What is difference b/w Get and Post method ?
Question2 : What is difference b/w Asp and Asp.Net ?
Question3 : Connection based and Not Connection Based Object ?
Question4 : What is portals ?
Question5 :What is authentication ? How many type of Authentication module ?



Porteck India infoServics , Noida , 20 huly 2007

Question1 : What is MSIL ?
Question2 :Which Event occure in the Asp.Net ?
Question3 : What is the session state ?
Question4 : What is GAC ?
Question5 : What is Web Services ?
Question6 :What is Serilization ?
Question7 : What is index? And how many types of Indexis ?
Question8 : What is DTD in the database (Sql) ?
Question9 :What is authentication ? How many type of Authentication module ?
Question10 : What is Assembly ? What is the Private assembly and Shared assembly ?




FTechnologies Noida , 8 August 2007


Question1 : What is Structure and Class ?
Question2 : What is impartance of Web.config file ?
Question3 : How many types of Dll ?
Question4 : What is Procedure ?
Question5 :What is CLR and how managed code?
Question6 : What is Structure and Class ?
Question7 : Is it possible to run program without Web.config file ?
Question8 : Difference between Asp and Asp.Net?
Question9 : What is Assembly?
Question10 :What are Delegate?
Question11 : What is Database?
Question12 : What is difference between Table and Schema?
Question13 : Select all records from two tables without nesting and subquery?
Question14 : What is JIT and how many types ?
Question15 :Abstrcat class ? Necessary condition for class being abstract ?
Question16: What is Hash Table ?
Question2 : What is Mail Class?
Question3 : How would make class in .Net ?
Question4 : What is Procedure ?
Question5 :What is CLR and how managed code ?




R System , Noida , 15 Sep 2007


Question1 : How many Templets in DataGrid ?
Question2 : In Stored Procedure if there are 4 select stement then how many table show this statemanet?
Question3 : Where stored Shared Assembly ?
Question4 : What is Delegate and how would define ?
Question5 :What is Web Services and how u difine class ?
Question6 : How many events occure in between init() and load() ?
Question7 : There are three controls then in which order it will come in init() event ?
Question8 : What is caching and how many types of caching ?
Question9 : What is Event in the page life cycle?



Binary Scmantics Ltd , Gurgoan , 30 Oct 2007


Question1 : What is index ? How many Types of Indexes ?
Question2 : What is cruser ? What is the condition of Explicit cruser and Implicity Crusers ?
Question3 : What is Stored Procedure ?
Question4 : What is the condition for outer join ?
Question5 :Which command you would use to delete all the record but remain the structure ? Question6 : You will change where clase or you will use group by clause ?