Posts

Showing posts from February, 2017

Interview Question

1.Program for Singleton pattern. 2.What is private constructor and static constructor. 3.What do you mean by static? 4.When do you prefer static constructor. 5.What you write in static constructor. 6.Thread safety while creating Singleton pattern. 7.How you implicitly call Static Constructor. 8.What if static variable value is not assigned to that variable and you try to access it.How do you avoid such scenarios. 9.Design a Logger Framework. 10.Thread safety in Logger class. 11.Can you define const variable as a static. 12.How to you create a thread in a class for calling logger class to log particular data in your log file. 13.Program cc= new Program();//How do you stop other classes while they try to create an instance of class Program. 14.What are the difference ways to create a thread. 15.Can static constructor access all the members of a class? 16.when would a static constructor be called? 17.How to do you explicitly call a static constructor. ...

Constructor in c#

Question: W hat is the output of the below code?  namespace ConsoleApplication1 {     class A     {         public A()         {             Console .WriteLine( "A.Constructor" );         }         public A( string abc)         {             Console .WriteLine( "A.Constructor " + abc);         }         public void Show()         {             Console .WriteLine( "A.Show()" );         }     }     class B ...

Constructor in c#

Question : What is the output of the below code? using System; using System.Text; namespace ConsoleApplication1 {     class A     {         public A()         {             Console .WriteLine( "A.Constructor" );         }         public A( string abc)         {             Console .WriteLine( "A.Constructor " + abc);         }         public void Show()         {             Console .WriteLine( "A.Show()" );         }   ...

Sql

https://www.simple-talk.com/sql/t-sql-programming/ten-common-sql-programming-mistakes/ Go through this link for some general sql mistakes done in daily life programming. 

OOPS

         public interface I1     {         void Add();     }     interface I2     {         void Add();     }     public class A : I1 , I2     {         void I1 .Add()         {             Console .WriteLine( "A - I1" );         }         void I2 .Add()         {             Console .WriteLine( "A - I2" );         }     }     class Program     {   ...

OOPS

class A     {         public void Display()         {             Console .WriteLine( "class A display" );         }     }     class B : A     {         public void Display()         {             Console .WriteLine( "class B display" );         }         public void Print()         {             Console .WriteLine( "class B print" );         }     }     class Program ...

OOPS

interface I1     {         void Add();     }     class A     {         public void Add()         {             Console .WriteLine( "A" );         }     }     class B : A , I1     {     } Reason: Class B inherit parent class data member and member function so  Interface I1 get its implementation inside parents class i.e. class A.