Tuesday, June 14, 2016

Infogain

1. Explain design pattern
Design Pattern

2. Difference between var and dynamic
Click Here For Diff

3. Can we have static constructor in abstract class?
Ans : Yes

4. Can we have both in same class static constructor and instance constructor?
Ans : Yes

5. Difference between override and new
Click Here

6. Difference between value type and reference type
7. Is it possible int? i=null
Ans Yes

8. Difference between factory and Abstract Factory
9. Define singleton pattern
10. Where singleton pattern used in .net?
Ans Dispatcher

11. What is the use of using statement?
Ans. Call the Dispose method if object is created using using statement.

12. If any error occur during execution of using block, did dispose method would call?
Ans Yes

13. Is it possible to define two catch statement where super exception class is above sub class?
Ans : Not possible, will give compile time error

14. Implement a queue with the help of two stack
15. Can we assign base class object to child class object?
Ans : No

16. Is static variable allowed inside function C#?
Ans : No, static variable are not allowed inside function in C# while they are allowed in C and C++.

There are two reasons C# doesn't have this feature.

First, it is possible to get nearly the same effect by having a class-level static, and adding method statics would require increased complexity.

Second, method level statics are somewhat notorious for causing problems when code is called repeatedly or from multiple threads, and since the definitions are in the methods, it's harder to find the definitions.

No comments:

Followers

Link