Monday, August 5, 2024

intview questions

using System;
public class HelloWorld
{
    public static void Main(string[] args)
    {
        A obja=new B();
        obja.Method();
    }
}

public class A{

    static A(){
        Console.WriteLine("construct static A");
    }

    public A(){
         Console.WriteLine("construct default A");
    }

    public void Method(){
         Console.WriteLine("called method of A");
    }
}

public class B : A
{
    static B(){
        Console.WriteLine("construct static B");
    }

    public B(){
         Console.WriteLine("construct default B");
    }

    public void Method(){
         Console.WriteLine("called method of B");
    }
}

 

Output :

construct static B

construct static A

construct default A

construct default B

called method of A

Thursday, July 18, 2024

Using Orderby ascending and Orderby descending to sort array javascript

Array.prototype.orderby=function()
{
  let self=this;
  let arr=[self[0]], i=1;
    for(;i<self.length; i++)
    {
      let index=arr.findIndex(f=>f > self[i]);
      arr.splice(index==-1?arr.length: index, 0, self[i]);
    }
  return arr;
}

Array.prototype.orderdescby=function()
{ 
 let self=this;
 let arr=[self[0]], i=1;
    for(;i<self.length; i++)
    {
        let index=arr.findIndex(f=>f < self[i]);
        arr.splice(index==-1?arr.length:index,0,self[i]);
    }
 return arr;
}

const points = [40, 100, 1, 500, 25, 107,0];
console.log(points.orderby())
console.log(points.orderdescby())
AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath