Tuesday, 6 November 2018

IQ


  1. Can we Declare non static methods in static class?
  • No we can't declare non static methods in static class
  1. Can we Declare static methods in Non static class?


  • Yes we can declare non static methods in static class.
 public  class MyStaticClass
    {
        public static int cnt = 0;
        public int cv = 0;
        public int add(int a,int b)
        {
            return a + b;           
        }
        public static int add1(int a, int b)
        {
            return a+b;            
        }
    }

    class Program
    {
        
        static void Main(string[] args)
        {
            int a = 0;
            int b = 0;
            MyStaticClass obj = new MyStaticClass();
            b=MyStaticClass.add1(2, 3);
            a= obj.add(3, 5);
            Console.WriteLine(a);
            Console.WriteLine(b);
            Console.ReadLine();
        }
    }

  • Given number is prime number or not?
  • Reverse a number in c# code?
  • how to change first letter as capital one in sql
    declare @val varchar(10)
      set @val='gupta'
        select upper(left(@val, 1)) + right(@val,LEN(@val)-1) 


      • O/P--Gupta

      • SELECT ISNULL(NULL, 'TEST')
      • --O/P--Test

      • SELECT COALESCE(NULL, 'Test','W3Schools.com');
      • --O/P--Test



        • What is collation?
          Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.
        How to remove duplicate records in sql.
         With CTE_Duplicates as
           (select empid,name , row_number() over(partition by empid,name order by empid,name ) rownumber 
           from EmpDup  )
           delete from CTE_Duplicates where rownumber!=1
           
        At a time 10 members sends a request to IIS then How IIS is able to find which request is which person?



        No comments:

        Post a Comment