Friday, May 27, 2011

Interview Questions H.. 12

1)Write a query to get the fifth higest salary froma table.
Ans. Select min(custkey) from (Select top 5 * from Customers order by custkey desc) as topfive

2) Difference between Class and object.
Ans. Class is a collection of functions and data(variables) while object is away to access those functions and variable.

3) What are the different properties of OOPS?
1) Encapsulation 2) Inheritance 3) Polymorphism 4) Abstraction

4) Trigger on Log on
Ans. Yes we can create Log On Trigger in SQL 2005. It will fire whenever any one will login. But there some problem I have notice it is doing multiple entries for one login, 3 for me.

5) Trigger on ddl.
Ans. Yes we can create Trigger on DDL in SQL 2005.

6) Which one is saved in memory object or class?
Ans. Please let me know if you find the answer.

7) What is serialization? And why we use it?
Ans. To save the state of object in a form that can be save in memory or transfer through wire.It is called serialization. We use this in games to save the intermediate state of game or any other place where is required.

8) What is Reflection?
Ans. Reflection is used to call an assembly or class functions dynamically. Or to access any other information from assembly.

9) What is Singleton Patter?
Ans. Single Pattern to strict the creation of object ( only one object). This can be achieved using private constructor. Singlton

10) What other design pattern you know?
Ans. 1) Iterator Pattern 2)Abstract Factory 3) Factory Pattern.4) Prototype Pattern

11) C# is case sensitive ?
Ans. Yes

12) VB.Net is case sensitive ?
Ans. No

13) Join
Ans. Click here

14) Garbage Collection.
Ans. Click here for detailed explanation

15) Difference between hiding and overriding.
1) When you want a same name function in child class without overriding than you can hide the function. Hide function is completely new function for child there is no relation of this method to base class. Both methods signature can be different.
2)For Hiding we use new keyword while for overriding we use override keyword. Hiding is also applicable by default.
3)If you have assigned child class reference to base class variable it shows different behavior for hiding and overriding. In hiding it will call base class method while in case of overriding it will call child class method.

No comments: