Friday, April 1, 2016

Interview


1. Difference between Specialization and Generalization
2. Diff between between Agregation and Composition
3. Difference between Truncate and Delete. Click Here
4. What is Modal Vendor?
5. What is Transaction in WCF?
6. Difference Between Interface and Abstract class? Click Here
7. If you have User control with a submit button on it and you want to fired click event of submit button on page load? What is the way?
8. What is thread Affinity? Click Here
9. What is Dispatcher? Click Here
10. What is Web API?
11. What is REST?


Specialization and Generalization

Specialization is Bottom-Up approach, take the common properties or method from sub classes and create a super class.

Generalization is Top-Down approach, split the super into multiple sub classes

Example : Account is Super class while SavingAccount and CurrentAccount are two sub classes


Difference Between Association,Aggregation and Composition


All three refer to relationship,
In Association there is no ownership, we say that there is an association between two classes  if they related to each other independent like Teacher and Student relationship, A student may associate to one or more than one teacher, same for teacher , A teacher can associate to one or multiple student. But both are independent can be delete or create independently. We say there is an association between class A and class B if class A has a reference to an instance of class B.

public class Association
{
    //SomeUtilityClass objSC   /*NO local reference maintained */
    public void doSomething(SomeUtilityClass obj)
    {
       obj.DoSomething();
    }
}

Aggregation 

Aggregation is a relationship where child and parent are independent and child can exist without parent like Class and Student relationship. If class will be deleted Student still exist.

Aggregation: Has-a. It has an existing object of another type

public class Aggregation
{
    SomeUtilityClass objSC
    public void doSomething(SomeUtilityClass obj)
    {
      objSC = obj;
    }
}

Composition 

Composition is refer to relationshipt where child and not exist without parent like Human Body and Hand,Face classes. If body is not exist than all child classes will not exist.

it is part of relationship

public class Composition
{
    SomeUtilityClass objSC = new SomeUtilityClass();
    public void doSomething()
    {
        objSC.someMethod();
    }
}

No comments:

Followers

Link