Thursday, April 7, 2011

Intw Questions Part4 (Initto)

difference b/w Method overloading & Method Overriding

difference between Multiple Inheritance & Interface

Difference b/w Stored Proc and triggers

sp and trigger are both predefined set of sql statements
1. SP may Return a value but Trigger Not,
2. In SP you can pass parameter But in trigger you can't
3. we explicitly call the Sp when Trigger are implicitly 
fired
4. you can write a sp in Trigger but in a Trigger you cant 
write SP.
5. Trigger written on an individual Table or View where SP 
is written for an Database
6. In case of sql queries,it is possible to compile one query 
at a time,but incase of stored procedure we can compile 
bunch of queries at a time and also it is need at first 
time only,suppose we need modification on queries,after 
modifications no need to compile again in case of stored 
procedures,but in case of sql queries we have to compile 
every time.Stored procedure contain queries in compiled 
format so execution also fast and tome saving. 


Difference b/w Left Outer Join & Inner Join 
    What are Delegates?
    • Delegates are just function pointers, That is, they hold references to functions.
    • A Delegate is a class. When you create an instance of it, you pass in the function name (as a parameter for the delegate's constructor) to which this delegate will refer.
    • Delegates allow methods to be passed as parameters
    • Delegate is a type which  holds the method(s) reference in an object
    • Effective use of delegate improves the performance of application
    Public delegate double Delegate_Prod(int a,int b);
    class Class1
    {
        static double fn_Prodvalues(int val1,int val2)
        {
            return val1*val2;
        }
        static void Main(string[] args)
        {
            //Creating the Delegate Instance
            Delegate_Prod delObj = new Delegate_Prod(fn_Prodvalues);
            Console.Write("Please Enter Values");
            int v1 = Int32.Parse(Console.ReadLine());
            int v2 = Int32.Parse(Console.ReadLine());
            //use a delegate for processing
            double res = delObj(v1,v2);
            Console.WriteLine ("Result :"+res);
            Console.ReadLine();
        }
    }

    Here I have used a small program which demonstrates the use of delegate.
    The delegate "Delegate_Prod" is declared with double return type and accepts only two integer parameters.
    Inside the class, the method named fn_Prodvalues is defined with double return type and two integer parameters. (The delegate and method have the same signature and parameter type.)
    Inside the Main method, the delegate instance is created and the function name is passed to the delegate instance as follows:

    Delegate_Prod delObj = new Delegate_Prod(fn_Prodvalues);
    After this, we are accepting the two values from the user and passing those values to the delegate as we do using method:

    delObj(v1,v2);
    Here delegate object encapsulates the method functionalities and returns the result as we specified in the method.
     What is Multicast Delegate?

    It is a delegate which holds the reference of more than one method.
    Multicast delegates must contain only methods that return void, else there is a run-time exception

    What are Events?
    • Events are variables of type delegates.
    • if you want to declare an event, you just declare a variable of type some delegate and put event keyword before your declaration e.g. 
                                                      public event NumberReachedEventHandler NumberReached;
    •  
    What are function pointers?

    Query to retrieve number of records from a table apart from Count (*) 

    select MAX(en) AS A from (
    select ROW_NUMBER() OVER( ORDER BY companyname ) AS en from TSQL2012.Production.Suppliers)
    as An


    How to set up Functional & Performance test environment

    Functional test case techniques (Galax e Solutions)

    Web Services testing in different environments e.g. Functional , UAT 

      Program for finding prime number in a range 

      static void prime(int LowLmt, int UpLmt)
              {
                  int c, d;
                  while (LowLmt <= UpLmt)
                  {
                      c = 0;
                      for (d = 1; d <= LowLmt; d++)
                      {
                          if (LowLmt % d == 0)
                              c++;
                      }
                      if (c == 2)
                          Console.WriteLine(LowLmt);
                      LowLmt++;
                  }
              }
      Program for reversing a number as an integer
         static int rev(int a)
                {
                    int b = 10;
                    //int c = 0;
                    int i = 0;
                    while (a > 0)
                    {
                        i *= b;
                        i += (a % b);
                        a /= b;
                       // c /= b;
                    }
                    return i;
                }  

        Program for reversing a number as string 
         static string rev(string str)
                {
                    char[] ch = str.ToCharArray(0, str.Length);
                    string str1 = "";
                    for (int i = str.Length - 1; i >= 1; i--)
                    {
                        str1 +=ch[i];
                    }
                    return str1;
                }
        Agile model, Scrum
           Agile:
          # based on iterative and incremental development
          # Customer satisfaction by rapid delivery of useful software
          # Welcome changing requirements, even late in development
          # Working software is delivered frequently
          # Close, daily co-operation between business people and developers
          # Face-to-face conversation is the best form of communication (co-location)
          # Projects are built around motivated individuals, who should be trusted
          # Self-organizing teams
          # Regular adaptation to changing circumstances

          # Agile methods break tasks into small increments with minimal planning, and do not directly involve long-term planning.
          # Iterations are short time frames (timeboxes) that typically last from one to four weeks. # Each iteration involves a team working through a full software development cycle including planning, requirements analysis, design, coding, unit testing, and acceptance testing when a working product is demonstrated to stakeholders.
          # Stakeholders produce documentation as required.

          # Team composition in an agile project is usually cross-functional and self-organizing without consideration for any existing corporate hierarchy or the corporate roles of team members.
          # Team members normally take responsibility for tasks that deliver the functionality an iteration requires.

          Scrum:
          # iterative, incremental methodology for project management often seen in agile software development
          # The main roles in Scrum are:
             1. the “ScrumMaster”, who maintains the processes (typically in lieu of a project manager)
             2. the “Product Owner”, who represents the stakeholders and the business
             3. the “Team”, a cross-functional group of about 5-9 people who do the actual analysis, design, implementation, testing, etc.

          # During each “sprint”, typically a two to four week period (with the length being decided by the team), the team creates a potentially shippable product increment (for example, working and tested software).

          # The set of features that go into a sprint come from the product “backlog”, which is a prioritized set of high level requirements of work to be done. Which backlog items go into the sprint is determined during the sprint planning meeting. During this meeting, the Product Owner informs the team of the items in the product backlog that he or she wants completed. The team then determines how much of this they can commit to complete during the next sprint, and records this in the sprint backlog.[4] During a sprint, no one is allowed to change the sprint backlog, which means that the requirements are frozen for that sprint. Development is timeboxed such that the sprint must end on time; if requirements are not completed for any reason they are left out and returned to the product backlog. After a sprint is completed, the team demonstrates how to use the software.

          # Represents a radically new approach for planning and managing software projects brings decision making authority to the level of operation properties and on certainties, scrum reduces defects , makes development process more efficient and reduces long term maintenance cost.[7]

              * What have you done since yesterday?
              * What are you planning to do today?
              * Do you have any problems that would prevent you from accomplishing your goal? (It is the role of the ScrumMaster to facilitate resolution of these impediments, although the resolution should occur outside the Daily Scrum itself to keep it under 15 minutes.)